BUG: TCP Connection Fails to Reset After SO_LINGER Timeout
Article ID: 176736
Article Last Modified on 7/11/2005
APPLIES TO
- Microsoft Platform Software Development Kit-January 2000 Edition, when used with:
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.
Additional query words: winsock tcp ip reset fin so_linger connection abort
Keywords: kbbug kbwinsock kbnetwork kbip KB176736