root@wotk.UUCP (Superuser) (08/08/90)
I have a BSD 4.3 tahoe system and I have the source code. If I have a connected socket connection, how can I tell when the other end has done a close()? As best as I can tell from the source, the bit in so_state represented by SS_ISCONNECTED is toggled off. Since I have source is it fair to just check this bit? Also I am doing non-blocking i/o with read. Would read() return 0 when the other end closes or -1 with errno set? Thanks, Nick Hennenfent Voice 404 475-2725 Computone Products FAX 404 343-9735 1100 Northmeadow Parkway Usenet ...!uunet!wotk!{nickh,root} Suite 150 Roswell, GA 30076
swise@elric.austin.ibm.com (The Diet Coke Guy) (08/09/90)
In article <10@wotk.UUCP> you write: >I have a BSD 4.3 tahoe system and I have the source code. > >If I have a connected socket connection, how can I tell >when the other end has done a close()? > >As best as I can tell from the source, the bit in so_state >represented by SS_ISCONNECTED is toggled off. Since I have >source is it fair to just check this bit? Yes, you can use this bit to detect whether the peer is still connected. > >Also I am doing non-blocking i/o with read. Would read() >return 0 when the other end closes or -1 with errno set? read() returns 0 when you read on a socket that has had the peer do a close(). ******** Steve Wise - IBM Advanced Workstation Division - Austin, Tx. swise@elric.austin.ibm.com AUSVMQ(SWISE) uunet.UU.NET!cs.utexas.edu!ibmchs!auschs!elric.austin.ibm.com!swise