From Xojo Documentation


EasyTCPSocket.WaitForMessage(Command as Int32, Timeout as Integer) As String

Supported for all project types and targets.

Waits for a message identified by the value of Command.


Effective with 2017r3, the command parameter is Int32 instead of Integer to prevent incorrect behavior in 64-bit apps.

Returns a String, containing the message text. The timeout is the amount of time in seconds that the socket will wait for a message before stopping.

The command parameter can be used as a code to identify the type of data that is sent. For example, you could send a command ID of 100 to mean that the string data is actually a memory block containing a FolderItem. Or, you could define ID 101 as the username of a remote application. This message mode is enforced on you in that you cannot use an arbitrary Write command. If you’d like to send arbitrary data, then you can make up a miscellaneous command ID and send your arbitrary data.

Command IDs less than 0 are reserved for internal use. When you are sending messages, you should not use a command ID less than 0, as it may very well cause issues with other classes.