View Single Post

   
  #8 (permalink)  
Old 01-16-2008, 08:58 PM
Rick Jones
 
Posts: n/a
Default Re: Shutdown fails with errno zero

cbr <chris_breemer@nl.compuware.com> wrote:
> Yes, I know close() will get rid of the socket for sure. It may be
> paranoid to do shutdown and close. Yet it seems like the right thing
> to do....


Well, it won't _break_ anything, but being a performance guy, I always
tweak at unnecessary work being done


> Shutdown without close does not clean up the filehandle,


Correct.

> and close without shutdown - well I have to trust that close is
> clever, recognizes the handle as a socket, and does whatever is
> necessary to clean up the TCP connection. Presumably close() does
> that on HP-UX, but are we sure it works the same on other UNIX
> platforms ?


Yes. Quite sure. It is functionally equivalent to do

shutdown(SHU_RDWR);
close()

or

close();

Where things differ is when you use SHUT_WR or SHUT_RD instead of
SHUT_RDWR.

rick jones
--
The glass is neither half-empty nor half-full. The glass has a leak.
The real question is "Can it be patched?"
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
Reply With Quote