The information in this article applies to:
SYMPTOMSOn Windows 95 and Windows 98, after launching a few WinSock applications using the WSADuplicateSocket() function, you will no longer able to create a socket connection. An attempt to call connect() function fails with the following error message:
CAUSE
For a duplicated TCP socket on Windows 95 and Windows 98, the closesocket() function fails to close the connection of the duplicated socket. This can be a problem when you launch several (10 to 20) applications which use WSADuplicateSocket() to create a duplicate socket and call closesocket() to clean up the connection. It eventually exhausts all the socket resources. Using the NETSTAT -AN command shows the maximum number of sockets already in use and most of them are either in CLOSE_WAIT or FIN_WAIT_2 state indefinitely. At this point, any attempt to call connect() will fail with error WSAENOBUFS since there is no more socket available for a new connection.
RESOLUTIONThe workaround would require the child application to create a dummy TCP socket (just call socket (AF_INET, ,,,)) and close it at its own leisure. The other possibility is to close the socket that is being duplicated in the parent process only after child is done with it. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. Additional query words: kbDSupport WSADuplicateSocket
Keywords : kbWinsock |
Last Reviewed: June 8, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |