TcpReadUTF


TcpReadUTF connection, data$

This command reads 16 bit unicode characters, in the UTF-8 string format, from a specified TCP socket connection. Any data read is returned in the data$ parameter. This command should be used to receive a string sent by a TcpWriteUTF.

Strings are encoded in a slightly modified form of UTF-8. This form is identical to standard UTF-8, except:

- Only the one-, two-, and three-byte encodings are used.

- Characters in the range U+10000 thru U+10ffff are encoded as a surrogate pair, each of which is represented as a three-byte encoded value. The character U+0000 is encoded in two-byte form.

After a TcpReadUTF 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.





TcpOpen


TcpClose


TcpGetState()


TcpGetError$()


TCPGetAddr$()


TcpGetSize()


TcpRead


TcpReadln


TcpWrite


TcpWriteln


TcpWriteUTF







Become a Patron