*BSD News Article 69080


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.mel.connect.com.au!news.mira.net.au!news.vbc.net!samba.rahul.net!rahul.net!a2i!news.PBI.net!decwrl!enews.sgi.com!lll-winken.llnl.gov!venus.sun.com!cs.utexas.edu!ennfs.eas.asu.edu!noao!rstevens
From: rstevens@noao.edu (W. Richard Stevens)
Newsgroups: comp.unix.bsd.misc,comp.unix.sys5.r4
Subject: Re: TCP socket close() behavior (Was: Imcomplete Documents and Images from httpd)
Date: 21 May 1996 21:38:11 GMT
Organization: National Optical Astronomy Observatories, Tucson, AZ, USA
Lines: 27
Message-ID: <4ntd43$mn1@noao.edu>
References: <319b6555@yoda.omnicron.com> <4nkuav$q54@noao.edu> <31a1f624@yoda.omnicron.com>
NNTP-Posting-Host: gemini.tuc.noao.edu
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.misc:1087 comp.unix.sys5.r4:11002

> I submit for discussion the question of whether the kernel must attempt
> to deliver pending sent data when a close() is performed on a connected
> TCP socket without the SO_LINGER option enabled.
>
> Therefore, I interpret that to strictly comply with the documented
> interface, it is necessary to enable SO_LINGER before closing a socket
> if you want to guarantee that the kernel will attempt to deliver all
> previously written data.
>
> I recieved some additional information from peter@haywire.DIALix.COM
> (Peter Wemm).  He says that the BSD implementation has in fact attempted
> to deliver the unsent data as far back as the net/1 code, and that the
> BSD Design & Implementation book is simply out of date.
>
> But it's not clear to me that the SVR4 behavior is actually "wrong" just
> because it matches the 4.3BSD spec (man pages) and not the net/1
> behavior.
>
> Is there any more authoritative documentation for this aspect of sockets
> semantics?  Is the httpd software "wrong" to omit the SO_LINGER option?

Posix.1g, Draft 6.3 states "A normal disconnect initiated by closing a
TCP socket with the SO_LINGER option disabled or with a linger time other
than zero shall not cause data to be discarded" (p. 278).  That's pretty
explicit, and I maintain is the "existing practice".

	Rich Stevens