Method _Stdio.UDP()->read()

class _Stdio.UDP

Method read

mapping(string:int|string)|zero read()
mapping(string:int|string)|zero read(int flag)

Description

Read from the UDP socket.

Flag flag is a bitfield, 1 for out of band data and 2 for peek

Returns

On success a mapping(string:int|string) in the form ([ "data" : string received data "ip" : string received from this ip "port" : int ...and this port ])

Returns 0 (zero) if no data was available to read on a nonblocking socket.

See also

Stdio.UDP()->set_read_callback(), MSG_OOB, MSG_PEEK