Error codes are unsigned 32-bit values which are private to each
calling thread. You should call the InetGetLastError function
immediately when a function's return value indicates that an error
has occurred. That is because some functions call
InetSetLastError(0) when they succeed, clearing the error code
set by the most recently failed function.
Most functions will set the last error code value when they fail;
a few functions set it when they succeed. Function failure is
typically indicated by a return value such as FALSE, NULL,
INVALID_SOCKET or INET_ERROR. Those functions which call
InetSetLastError when they succeed are noted on the function
reference page.