UDP RECV statement

Purpose

Receive data from a previously opened UDP port.

Syntax

UDP RECV [#] fNum&, FROM ip&, pNum&, Buffer$

Remarks

Receive any bytes from the previously opened UDP port specified by fNum&, and place them into Buffer$.  The IP address that sent the UDP packet is placed into the ip& variable, and the port number is placed into the pNum& variable.

ip& and pNum& may be subsequently used to send data back in response to data received.

UDP RECV is a blocking statement.  That is, execution does not continue until either data is retrieved from the socket, or the timeout period expires.

If a timeout occurs, a run-time Error 24 ("Device timeout") is generated and placed in the ERR system variable.  See UDP OPEN to specify the UDP socket timeout value.

See also

TCP and UDP Communication, TCP RECV, UDP CLOSE, UDP NOTIFY, UDP OPEN, UDP SEND