Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!fcom.cc.utah.edu!npd.novell.com!excelan!george From: george@na.excelan.com (George Powers) Newsgroups: comp.protocols.tcp-ip Subject: Re: Questions on TCP shutdown and RFC-793 Message-ID: <2545@excelan.COM> Date: 29 Dec 90 00:05:20 GMT References: <36540017@hpindwa.cup.hp.com> <2452@mentor.cc.purdue.edu> <1990Dec10.131116.19393@jarvis.csri.toronto.edu> <2527@mentor.cc.purdue.edu> Sender: news@excelan.COM Reply-To: george@na.excelan.com (George Powers) Organization: Excelan, Inc., San Jose, Califonia Lines: 32 > In article <1990Dec10.131116.19393@jarvis.csri.toronto.edu>, thomson@hub.toronto.edu (Brian Thomson) writes: > > > > I think the original question was about the TCP shutdown procedure, not the > > BSD shutdown() system call, but this answer caught my attention because it > > seems to contradict everything I thought I knew about the BSD routine. > > My understanding is as follows: > > shutdown(s, 0) - flushes data queued for receive, and shrinks > > my receive window to zero. Succeeding reads will > > fail. > > shutdown(s, 1) - data already queued will be delivered, followed > > by a FIN. Succeeding writes will fail. > > shutdown(s, 2) - equivalent to { shutdown(s, 0); shutdown(s, 1); } > > ... > > > > And, to top it off, my manual pages (Sun) say nothing about loss of > > buffered data pending. Having read the 4.3BSD source and tested SUNOS 4.0, I agree with Brian. Shutdown is typically useful when applied to the send direction. The application program can then keep reading until it gets an EOF, meaning that the peer application has seen the EOF which shutdown caused, and has closed in response. Therefore the application which initiated the shutdown can be sure that all data has been delivered in both directions. If an application has no other way of confirming delivery and closes without the shutdown method, it cannot tell whether enqueued send data is lost after close detaches the socket from its file descriptor. -- UUCP: {ames,sun,apple,mtxinu,cae780,sco}!novell!george George Powers Internet: george@novell.com --