Error Reporting and Parameter Validation

The scheme for error reporting differs between the SPI and API interfaces. Windows Sockets service providers report errors along with the function returning, as opposed to the per-thread based approach utilized in the API. The WS2_32.DLL uses the service provider's per-function error code to update the per-thread error value that is obtained via the WSAGetLastError API function. Service providers are still required, however, to maintain the per-socket based error which can be retrieved via the SO_ERROR socket option.

The WS2_32.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.