Purpose |
Receive a line of text from a specified TCP/IP port. |
Syntax |
TCP LINE [INPUT] [#] fNum&, Buffer$ |
Remarks |
Receive a line of text from the fNum& TCP/IP port, and place the data in Buffer$. If no bytes are available, Buffer$ will be empty (a null string). If TCP LINE did not receive a complete line of text (terminated by a $CRLF character pair), EOF(fNum&) will return TRUE (non-zero). If a time-out occurs, ERR will be set to indicate a run-time Error 24 ("Device timeout"). See TCP OPEN to specify the TCP socket timeout value. The EOF function may also be used with TCP LINE (and COMM LINE) to detect that an incomplete line was received. Normally, the TCP LINE statement reads data until a $CRLF character pair is found, and in that case, EOF will return false (zero). However, even if no $CRLF has been found, TCP LINE will return if no additional data is available. In that case, TCP LINE will return whatever data has been accumulated, and set EOF to logical TRUE (non-zero). In many cases, it would be prudent to test EOF after every TCP LINE statement to verify that a full line has been received. In some cases, you may wish to execute the statement one or more additional times, combining the data, in order to obtain a full line of text. |
See also |
TCP and UDP communications, EOF, TCP ACCEPT, TCP CLOSE, TCP NOTIFY, TCP OPEN, TCP PRINT, TCP RECV, TCP SEND, UDP RECV |