How to detect if socket connection has dropped (ie. how to make SO_KEEP alive do what it says

How to detect if socket connection has dropped (ie. how to make SO_KEEP alive do what it says

Post by Colin Rhod » Tue, 06 Sep 1994 08:46:44



Hi all,

I'm writing an application in OS/2 that needs to check whether a
socket connection it is using is still alive.  In Stephens the option
SO_KEEPALIVE is discussed, but there is no mention of how to set the
amount of time before TCP/IP sends a packet to see if the other end
_really_ is alive. (The other end is a 55L RS/6000)

Does anyone have any ideas?

Ta,

Colin.

 
 
 

How to detect if socket connection has dropped (ie. how to make SO_KEEP alive do what it says

Post by W. Richard Steve » Tue, 06 Sep 1994 21:03:28


Quote:> I'm writing an application in OS/2 that needs to check whether a
> socket connection it is using is still alive.  In Stephens the option
> SO_KEEPALIVE is discussed, but there is no mention of how to set the
> amount of time before TCP/IP sends a packet to see if the other end
> _really_ is alive. (The other end is a 55L RS/6000)

Most implementations do not give you per-socket control over the
keepalive parameters, but system-wide control.  Also, while the use
of this socket option is trivial, there are many subtle implications
(such as the possibility of dropping a perfectly good connection).

I suggest you read Chapter 23 of my recent "TCP/IP Illustrated"
(Addison-Wesley, 1994).  It's an entire chapter on what this option
does, and Appendix E gives the way to change the parameters on some
popular Unix systems.

        Rich Stevens

 
 
 

How to detect if socket connection has dropped (ie. how to make SO_KEEP alive do what it says

Post by Jeff Murp » Tue, 06 Sep 1994 14:13:52



>I'm writing an application in OS/2 that needs to check whether a
>socket connection it is using is still alive.  In Stephens the option
>SO_KEEPALIVE is discussed, but there is no mention of how to set the
>amount of time before TCP/IP sends a packet to see if the other end
>_really_ is alive. (The other end is a 55L RS/6000)

        you should be able to do a read() on it (which will return an
        error).. or it might return a SIGPIPE (under unix).. i forget
        which

--


''She walks in beauty, like the night - Of cloudless climes and starry skies.''