BUG: TCP Connection Fails to Reset After SO_LINGER Timeout

Last reviewed: November 17, 1997
Article ID: Q176736
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) on the following platform: - Windows NT

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 : NtwkMisc NtwkWinsock
Version : WINNT:4.0
Platform : winnt
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.