FIX: Timing Crack Between FD_CONNECT and Call to Shut Down API
Article ID: 186244
Article Last Modified on 10/29/2003
APPLIES TO
- Microsoft Windows NT Server 4.0 Standard Edition
- Microsoft Windows NT Workstation 4.0 Developer Edition
This article was previously published under Q186244
SYMPTOMS
When using WSAEventSelect, a call to the shutdown API shortly after
receiving a FD_CONNECT notification might fail with WSAENOTCONN.
CAUSE
There is a timing crack between receipt of a FD_CONNECT notification and a
subsequent call to the shutdown API where the system reports that the
socket is not connected.
RESOLUTION
Use one of the following to work around this problem:
- Use a blocking call to the connect or WSAConnect API.
- If you receive WSAENOTCONN when calling the shutdown API, place the call
to the shutdown API in a loop with a small delay (few milliseconds).
STATUS
This problem was corrected in Windows 2000.
Keywords: kbbug kbfix kbwinsock kbapi kbnetwork kboswin2000fix KB186244