BUG: TCP Connection Fails to Reset After SO_LINGER Timeout (176736)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • the operating system: Microsoft Windows NT 4.0

This article was previously published under Q176736

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.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbBug kbIP kbnetwork kbWinsock KB176736