This function retrieves the error status for the last Windows Socket operation that failed.
At a Glance
Header file: | Winsock.h |
Windows CE versions: | 1.0 and later |
Syntax
int WSAGetLastError(void);
Return Values
The return value indicates the error value for this thread’s last Windows Sockets operation that failed.
Remarks
The WSAGetLastError function returns the last network error that occurred. When a particular Windows Sockets function indicates that an error has occurred, this function should be called to retrieve the appropriate error value. This error value can be different from the error value obtained from getsockopt SO_ERROR, which is socket-specific since WSAGetLastError is for all thread-specific sockets.
A successful function call, or a call to WSAGetLastError, does not reset the error value. To reset the error value, use the WSASetLastError function call with iError set to zero. A getsockopt SO_ERROR also resets the error value to zero.
See Also