INFO: WSAGetLastError() Returns 0 Visual Basic on SOCKET_ERROR

ID: Q222058


The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)
  • Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 4.0, 5.0, 6.0


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.

Additional query words:

Keywords : kbVBp600 kbWinsock
Version : WINDOWS:4.0,5.0,6.0
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: April 8, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.