WINSOCK RECV STRING
If a channel has data waiting for you (indicated by WINSOCK CHANNEL DATA WAITING()), then you can use this command to receive the data in form of a string.
If the string is empty (length=0), then the connection has been closed. You should always check for this, as failing to do so may lead to an application crash!
Use the optional parameter length to only take the first 'length' bytes of data and return it as a string. You need this parameter if you use the TCP stream commands for sending and receiving (e.g WINSOCK SEND BYTE).
You can for example send the length of the string as a byte before you send the actual string, such that you can receive it correctly on the other side, by first receiving the length, and then receiving 'length' bytes of the string.
The strings are NOT null-terminated.
SYNTAX
Return String=WINSOCK RECV STRING(tcp_channel as Dword[, length as Integer])
RELATED INFO
WINSOCK command menu
Index
EXAMPLE
Showcase-example 1
Showcase-example 2