Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!ut-emx!ibmchs!auschs!awdprime!elric.austin.ibm.com!swise From: swise@elric.austin.ibm.com (The Diet Coke Guy) Newsgroups: comp.protocols.tcp-ip Subject: Re: detecting peer close() Message-ID: <3086@awdprime.UUCP> Date: 8 Aug 90 17:35:56 GMT Sender: news@awdprime.UUCP Organization: IBM AWD, Austin, TX Lines: 23 To: root@wotk.UUCP In-Reply-To: <10@wotk.UUCP> Cc: Bcc: 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