TcpWriteUTF connection, data$
This command writes 16 bit unicode characters to a specified TCP socket connection. This is a good function for sending UTF-8 string records. The TcpReadUTF$(n) command should be used to receive a strings sent by a TcpWriteUTF.
Strings are encoded in a slightly modified form of UTF-8. This form is identical to standard UTF-8, except:
After a TcpReadUTF$(n) 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.
TcpWriteUTF 1, data$