TcpRead


TcpRead connection, data$ {,maxBytes}

This command reads character bytes from a specified TCP socket connection. Any data read is returned in the data$ parameter. If no data is available to read an empty string will be returned. An optional maxBytes parameter specifies the maximum number of bytes to read. It is important to note that only the lower eight bits of each character is read. The strings returned by this command should be thought of as containing bytes.

After each TcpRead command 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()


TcpReadln


TcpReadUTF


TcpWrite


TcpWriteln


TcpWriteUTF







Become a Patron