Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Sep : Re: Indy 9 - not detecting disconnect over VPN

www.cryer.info
Managed Newsgroup Archive

Re: Indy 9 - not detecting disconnect over VPN

Subject:Re: Indy 9 - not detecting disconnect over VPN
Posted by:user@domain.invalid
Date:Thu, 20 Sep 2007 15:02:04

Remy Lebeau (TeamB) wrote:
> <user@domain.invalid> wrote in message
> news:46f2b09f$1@newsgroups.borland.com...
>
>> I am also sending a 0 length string if the socket is idle.  On
>> the server side, how do I catch (in order to reset my timeout)
>> the 0 length string?
>
> What I was referring to earlier was to have the server send the 0-length
> string to the client when idle (since the client is the one sitting in a
> reading loop).  That way, your loop could do something like the following:
>
>     while (not Terminated) and client.connected do begin
>        Count := Client.ReadInteger;
>         if Count = 0 then Continue; // <-- here
>         s := Client.ReadString(Count);
>         ...
>     end;
>
>> FWIW, I am using command handlers
>
> Then have the client send an actual command to the server periodically that
> the server responds to.
>
>
Sorry I muddied the water.  This same client server setup has a second
client/server socket that is configured more traditionally.  However,
when the VPN goes away, the server does not detect the client has
disconnected so that socket remains open from the server's perspective
(the client notices the disconnect correctly when it attempts to write
to the socket).

I am referring to this server side of this socket and would like to be
able to tell when the client goes away.  From your earlier message, I
was thinking of maintaining my own timeout scheme whereby I would note
the last traffic time and after x time elapsed without traffic, declare
it disconnected.

Would you recommend against this scheme?

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive