udp_receive(+Socket,
-Data, -From, +Options)- as(+Type)
- Defines the returned term-type. Type is one of
atom,codesorstring(default). - max_message_size(+Size)
- Specify the maximum number of bytes to read from a UDP datagram. Size must be within the range 0-65535. If unspecified, a maximum of 4096 bytes will be read.
The typical sequence to receive UDP data is:
receive(Port) :-
udp_socket(S),
tcp_bind(S, Port),
repeat,
udp_receive(Socket, Data, From, [as(atom)]),
format('Got ~q from ~q~n', [Data, From]),
fail.