PRB: WSAStartup() May Return WSAVERNOTSUPPORTED on Second Call
Article ID: 130942
Article Last Modified on 7/11/2005
APPLIES TO
- Microsoft Windows Software Development Kit 3.1, when used with:
- Microsoft Windows 3.1 Standard Edition
- Microsoft Platform Software Development Kit-January 2000 Edition, when used with:
- Microsoft Windows NT Advanced Server 3.1
- Microsoft Windows NT 3.51 Service Pack 5
- Microsoft Windows 2000 Standard Edition
This article was previously published under Q130942
SYMPTOMS
If two sections of code within the same process call WSAStartup(), the
second call to WSAStartup() fails and returns error WSAVERNOTSUPPORTED
unless the second call specifies the version negotiated in the first call.
This happens even if the requested version would normally be accepted.
Often the extra calls to WSAStartup() come from one or more DLLs loaded by
the process.
RESOLUTION
If multiple calls are made to WSAStartup(), the second call must request
the same version negotiated in the first call.
MORE INFORMATION
Some specific examples may help. Currently, if the version of Winsock
requested is 1.1 or greater, the negotiated version will be 1.1. If a
version less than 1.1 is requested, the call fails and returns the
WSAVERNOTSUPPORTED error.
Example One
First call : 1.1 requested
Second call: 1.1 requested
Result : Success
Example Two
First call : 2.0 requested
Second call: 1.1 requested
Result : Success
Example Three
First call : 2.0 requested
Second call: 2.0 requested
Result : WSAVERNOTSUPPORTED
Example Four
First call : 1.1 requested
Second call: 2.0 requested
Result : WSAVERNOTSUPPORTED
Keywords: kbwinsock kbapi kbnetwork kbprb KB130942