[comp.unix.questions] How to determine when a TCP connection has been broken?

gilstrap@pooh_corner.sbc.com (Brian R. Gilstrap) (12/05/90)

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@pooh_corner.tri.sbc.com
gilstrap@swbatl.sbc.com
...!{texbell,uunet}!swbatl{!pooh_corner}!gilstrap