TCP RECV statement

Purpose

Receive data from a specified TCP/IP port.

Syntax

TCP RECV [#] fNum&, count&, Buffer$

Remarks

Receive count& bytes from the fNum& TCP/IP port and place them in Buffer$.  If count& bytes are not available, Buffer$ will receive whatever bytes are available and EOF(fNum&) will return TRUE (non-zero).

Typically used in a loop to retrieve a stream of data, a TCP RECV loop should be terminated if Buffer$ returns an empty string, or if EOF(fNum&) returns TRUE, or if ERR becomes set.  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.

See also

TCP and UDP communications, EOF, TCP ACCEPT, TCP CLOSE, TCP LINE INPUT, TCP NOTIFY, TCP OPEN, TCP PRINT, TCP SEND, UDP RECV