Subject: Re: Detecting broken connection

Re: Detecting broken connection

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Wed, 14 Jul 2010 02:13:09 +0100

On 12 July 2010 17:31, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> If you _know_ the sockets should be silent (ie there's no TCP traffic on
> them) you can select() to see if they've become readable, and if they are in
> spite of you knowing they shouldn't be, reading 0 bytes from them indicates
> they're disconnected.

Do I need to actually do the read? What would a >0 return value
indicate? Presumably that I'd gotten my logic wrong and the socket
wasn't meant to be silent (impossible, I think, as long as I use
blocking libssh2 calls?). There doesn't seem to be a recoverable
scenario regardless the result of the read so I'm better off not doing
it at all and trashing the session anyway.

Many thanks.

Alex

--
Swish - Easy SFTP for Windows. http://www.swish-sftp.org
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-07-14