INFO: WSAGetLastError() Returns 0 Visual Basic on SOCKET_ERROR (222058)
The information in this article applies to:
- Microsoft Platform Software Development Kit (SDK) 1.0
- Microsoft Visual Basic Professional Edition for Windows 4.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 4.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q222058 SUMMARY
When calling Winsock API in Visual Basic, you may run into situations where the socket API calls return SOCKET_ERROR but WSAGetLastError returns 0. This is because Visual Basic retrieves the error code for each API call, sets the error code in Err.LastDllError, and then resets the error to 0.
Whenever there is an API call failure regardless of Winsock API or any other API, you need to retrieve the error code for the API from Err.LastDllError.
Modification Type: | Minor | Last Reviewed: | 7/11/2005 |
---|
Keywords: | kbDSWNET2003Swept kbinfo kbWinsock KB222058 |
---|
|