[e2e] Is this a bug with Windows TCP Stack ?

Bill Sommerfeld sommerfeld at orchard.arlington.ma.us
Mon Dec 13 06:55:05 PST 2004


On Fri, 2004-12-10 at 17:40, Tommy Marcus McGuire wrote:
> What I've seen (and interpret Sanjay's comments below to mean) is advice
> to use shutdown() (for both halves of the connection) and then close(),
> which doesn't make sense---the close() should report a local error
> since the shutdown has already done everything the close would do.  

Not quite.

In the systems I'm familiar with (not windows), shutdown() will not free
up the file descriptor even if you shut down both directions.

So a close() will succeed -- but at that point it has only local effect
(allowing the reuse of the file descriptor table slot within that
process).

two other points:
 1) on many systems, sockets can be shared between processes; 
a close() means that *this* process is done with the socket, but others
may still keep it open; however, "shutdown" is a declaration that *all*
users of the descriptor are done sending/receiving.

 2) It may also be the case -- I haven't checked yet -- that some of the
getsockopt() calls will still return sensible data after a shutdown.

					- Bill






More information about the end2end-interest mailing list