TcpReadln connection, data$
This command reads character bytes from a specified TCP socket connection until a newline character "\n" is encountered. Any data read is returned in the data$ parameter. The newline character is not included in the string returned. If no data is available to read an empty string will be returned. It is important to note that only the lower eight bits of each character is read. This is a good function for receiving regular string records. This command should be used to receive a string sent by a TcpWriteln command.
After a TcpReadln it is important to check if the read succeeded. All internet connections are subject to interruption at any time so check the TcpGetError$(n) after each TCP command you execute. TcpGetError$(n) will return an empty string if the read succeeded.
You can use the TcpGetSize(n) function to check how many bytes are available to be read.