From Xojo Documentation
The last error code for the socket.
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.
It may mean that WinSock (on Windows) is not installed, or the version is too early.
|101||This error code is no longer used.|
|102||LostConnection||This code means that you lost your connection.
You will get this error if the remote side disconnects (whether its forcibly- by pulling their ethernet cable out of the computer), or gracefully (by calling SocketCore's Close method). This may or not be a true error situation. If the remote side closed the connection, then it is not truly an error; it's just a status indication. But if they pulled the ethernet cable out of the computer, then it really is an error; but the results are the same. The connection was lost. You will also get this error if you call the Disconnect method of TCPSocket.
|103||NameResolutionError||The socket was unable to resolve the address that was specified.
A prime example of this would be a mistyped IP address, or a domain name of an unknown or unreachable host.
|104||This error code is no longer used.|
|105||AddressInUseError||The address is currently in use.
This error will occur if you attempt to bind to a port that you have already bound to. An example of this would be setting up two listening sockets to try to listen on the same port.
|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.
An example of this is calling the Write method before the socket is actually connected.
|107||InvalidPortError||This error means that the port you specified is invalid.
This could mean that you entered a port number less than 0, or greater than 65,535. It could also mean that you do not have enough privileges to bind to that port. This happens under macOS and Linux if you are not running as root and try to bind to a port below 1024. You can only bind to ports less than 1024 if you have root privileges. A normal "Admin" user does not have root privileges.
|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".
The following example in the Error event handler displays the error code.