How to determine when a TCP connection has been broken?

Brian R. Gilstrap gilstrap at pooh_corner.sbc.com
Wed Dec 5 03:14:33 AEST 1990


A silly question I'm sure, but how does one determine if a socket
associated with a TCP stream has been broken by the other end performing
a close(2) (or any other reason for that matter)?  The man pages are confusing
and the network applications tutorial for SunOS 4.1 doesn't address this
issue clearly...as far as I can find.

Ideally, I'd like to peform some test on the socket, rather than being
forced to do a "read" or "write".  In other words, I'd like to be able to
determine the validity of the socket without being forced to do a read from
or write to the socket (the design of my application makes
this desirable).

I'd very much appreciate any info (e-mail, since this is probably trivial).

Brian R. Gilstrap
gilstrap at pooh_corner.tri.sbc.com
gilstrap at swbatl.sbc.com
...!{texbell,uunet}!swbatl{!pooh_corner}!gilstrap



More information about the Comp.unix.questions mailing list