Description
Get the error status for the last operation which failed.
#include <winsock.h>
int PASCAL FAR WSAGetLastError ( void );
Remarks
This function returns the last network error that occurred. When a particular Windows Sockets API function indicates that an error has occurred, this function should be called to retrieve the appropriate error code.
Return Value
The return value indicates the error code for the last Windows Sockets API routine performed by this thread.
Notes For Windows Sockets Suppliers
The use of the WSAGetLastError() function to retrieve the last error code, rather than relying on a global error variable (cf. errno), is required in order to provide compatibility with future multi-threaded environments.
Note that in a Win16 environment WSAGetLastError() is used to retrieve only Windows Sockets API errors. In a Win32 environment, WSAGetLastError() will invoke GetLastError(), which is used to retrieve the error status for all Win32 API functions on a per-thread basis. For portability, an application should use WSAGetLastError() immediately after the Windows Sockets API function which failed.
See Also