Subject: Re: Detecting broken connection

Re: Detecting broken connection

From: Jose Baars <peut_at_peut.org>
Date: Wed, 14 Jul 2010 20:16:46 +0200

What also helps or might even be necessary, depending on your operating
system etc.,
is turning on SO_KEEPALIVE with set socketopt on your socket.
If you set this, you get an error from your socket, especially when doing a
select(),
if the connection is broken, if you don't set it, you may not.

If you're lucky, your system admin turned this on as a system-wide default,
if you're not lucky, or on Linux (where you can't turn this on as a system
wide default
the last time I looked), you might not be able to detect a broken
connection.

The SSH keepalive options might mitigate this, but I did not try, so no
idea.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-07-14