Error Reporting and Parameter Validation
A version of this page is also available for
4/8/2010
The scheme for error reporting differs between the SPI and API interfaces. Winsock service providers report errors in the return value, as opposed to the per-thread based approach utilized in the API. Ws2.dll uses the service provider's per-function error code to update the per-thread error value that is obtained through the WSAGetLastError function. Service providers are still required, however, to maintain the per-socket based error that can be retrieved through the SO_ERROR socket option.
Ws2.dll performs parameter validation only on function calls that are implemented entirely within itself. Service providers are responsible for performing all of their own parameter validation.