Property
SocketCore.LastErrorCode
Warning
This item was deprecated in version 2019r2. Please use SocketCore.Error as a replacement.
Description
The last error code for the socket.
Notes
These error codes provide you with key information about your socket, and it is not advisable to ignore them.
Some error codes are associated with a class constant. When you need to check whether a particular error occurred, you can check the value of the LastErrorCode property against these class constants.
Use the constants in the table below to compare to the LastErrorCode property.
Error Code |
Class Constant |
Description |
---|---|---|
0 |
NoError |
No error occurred. |
100 |
OpenDriverError |
There was an error opening and initializing the drivers. |
101 |
This error code is no longer used. |
|
102 |
LostConnection |
This code means that you lost your connection. |
103 |
NameResolutionError |
The socket was unable to resolve the address that was specified. |
104 |
This error code is no longer used. |
|
105 |
AddressInUseError |
The address is currently in use. |
106 |
InvalidStateError |
This is an invalid state error, which means that the socket is not in the proper state to be doing a certain operation. |
107 |
InvalidPortError |
This error means that the port you specified is invalid. |
108 |
OutOfMemoryError |
This error indicates that your application has run out of memory. |
However, these are not the only errors that are returned by LastErrorCode. If the provider's error code cannot be mapped to one of the above codes, it will pass you the provider's error code. For Windows, these error codes are usually positive numbers in the range [10004, 11004]. For Windows error codes, see WinSock.h. Macintosh and Linux use POSIX error codes. For a description of Macintosh and Linux error codes, see http://www.ioplex.com/~miallen/errcmp.html.
e.g. error 64 is for "host is down".
Sample code
The following example in the Error event handler displays the error code.
MsgBox(Str(Me.LastErrorCode))
Compatibility
All project types on all supported operating systems.