Newsgroups: comp.protocols.tcp-ip
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Monitoring TCP/IP sockets
Message-ID: <1991Jan30.172337.7084@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <9101291553.AA06606@litwin.jpl.nasa.gov.>
Date: Wed, 30 Jan 1991 17:23:37 GMT

In article <9101291553.AA06606@litwin.jpl.nasa.gov.> litwin@ROBOTICS.JPL.NASA.GOV (Todd Litwin) writes:
>I have a program that uses TCP/IP sockets and needs to know quickly, within a
>second or so, if the physical connection between the two systems is broken.

This basically can't be done; it's easy to get transient interruptions that
last longer than that, and there is no reliable way to distinguish them
from a real break in the link.  If you're willing to consider even such a
hiccup as a failure, then you need some sort of keepalive protocol at a
higher level.  TCP/IP is deliberately very tolerant of outages.

>... I'm using setsockopt() to turn on SO_KEEPALIVE, but this
>doesn't help, either....

SO_KEEPALIVE is a kludge; its timeout period is non-adjustable and quite
long.  You're going to have to do it yourself.
-- 
If the Space Shuttle was the answer,   | Henry Spencer at U of Toronto Zoology
what was the question?                 |  henry@zoo.toronto.edu   utzoo!henry
