FIN_WAIT_2 and a socket connect that takes an age to close.

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Andy Coates (nothanks_at_nowhere.com)
Date: 06/11/04


Date: Fri, 11 Jun 2004 15:11:07 +0100

Hi,

I'm using Overlapped IO and completion ports to handle socket connections
coming into a server application. On shutdown I iterate over any current
socket connections calling ::shutdown() on each socket. I then wait until
all pending overlapped operations complete.

This normally works fine, but I have one client application (for which I
can't easily get source) that causes problems on shutdown. This particular
socket takes ~2minutes before the queued read operations complete. When I
run netstat I see that the socket is in the FIN_WAIT_2 state, which I
understand to mean that it has received the ACK from the client.

Why is this socket taking so long to shutdown?

Thanks for any help or advice you can give,

Andy



Relevant Pages

  • Re: IOCP with graceful close
    ... socket is shutdown before the the send data is arrive to send queue of IOCP. ... >> server send a Command to client and then closesocket. ...
    (microsoft.public.win32.programmer.networks)
  • Re: Write-Only Socket
    ... I get the same behavior whether $socket ... > I don't see that happening regardless of what you shutdown. ... I changed my server script so it will not die but warn if 'getline' ... Here is the output after I had started the client ...
    (comp.lang.perl.misc)
  • Re: closing ASyncSocket
    ... I reread the help for the ShutDown() call. ... not close the socket, and resources attached to the socket will not be freed ... What if I want to Closethe connection to return resources. ... receiving side after I received the last data. ...
    (microsoft.public.vc.mfc)
  • RE: Does Socket.Shutdown or Socket.Close Block and when?
    ... receive a heartbeat message every 5 seconds on each socket (to make sure the ... connection is still up to each client). ... heartbeat within say 10 seconds then the server will proceed to shutdown the ... the send buffer is empty or becomes empty before the elapsed timeout. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Socket connect/disconnect, ReuseAddress, and TIME_WAIT
    ... More current versions of HTTP allow the socket to stay open and the client can make further http requests. ... At that point IE closes all open sockets via RST, ACK which is a hard shutdown. ...
    (microsoft.public.dotnet.languages.csharp)