Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!uakari.primate.wisc.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!purdue!mentor.cc.purdue.edu!dls From: dls@mentor.cc.purdue.edu (David L Stevens) Newsgroups: comp.protocols.tcp-ip Subject: Re: 'shutdown' vs. 'close' to free resources? Keywords: tcp shutdown socket Message-ID: <4577@mentor.cc.purdue.edu> Date: 18 Oct 89 17:25:28 GMT References: <239@melpar.UUCP> Reply-To: dls@mentor.cc.purdue.edu (David L Stevens) Distribution: usa Organization: PUCC UNIX Group Lines: 13 UNIX's shutdown(2) corresponds to the TCP ABORT function and is NOT generally a good way to free socket resources, unless you have another way of determining (through the upper level protocol) that no more data need be sent. In particular, if you do a shutdown(2) after you've written your data, if the data is still in a kernel buffer on your end waiting to be sent, it will be discarded and the other guy will never see it. Close(2) is the only way to guarantee delivery of all pending written data short of doing this in the upper protocol. In other words, close(2) isn't hanging onto everything just to be mean to you... :-) It's where some of TCP's reliability comes from. -- +-DLS (dls@mentor.cc.purdue.edu)