BUG: TCP Connection Fails to Reset After SO_LINGER Timeout

ID: Q176736

The information in this article applies to:

SYMPTOMS

After SO_LINGER timeout periods expires, TCPIP stack may fail to reset a TCP connection forcefully if you call the shutdown() with how=1 before calling the closesocket().

RESOLUTION

To avoid this problem, do not call shutdown() with how=1 before calling closesocket() with SO_LINGER enabled.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Before you call the closesocket(), you can call shutdown() how=1 to initiate a graceful shutdown. It sends a TCP FIN packet that tells the other side you are done sending, but still allows the other side to send.

With SO_LINGER enabled with a nonzero timeout, closesocket() attempts a graceful close until timeout period expires, then it will do a forceful close. However, the forceful close does not occur (that is, the TCPIP stack fails to send a TCP<RST>).

This can cause a problem because the TCP connection remains open and the other side is not notified that your Winsock application has shutdown.

Additional query words: winsock tcp ip reset fin so_linger connection abort

Keywords          : kbnetwork kbIP kbNTOS400bug kbSDKPlatform kbWinsock kbGrpNet 
Issue type        : kbbug

Last Reviewed: November 18, 1998