method
Udp.recv
Udp.recv(socket, bytes, cap) -> int
Copies the next waiting datagram, up to cap bytes, into bytes and returns its length, or 0 when nothing is waiting. It never blocks: call it in a loop each frame until it returns 0. The sender is Udp.from_ip / from_port.
Example
program Demo {
entry {
let s = Udp.open(port: 0)
let buf = Memory.bytes(64)
print(Udp.recv(socket: s, bytes: buf, cap: 64))
}
}