netRecvUDPMsg

Receives a UDP datagram into a buffer. Takes a handle (Int), buffer pointer (Int), and maximum size (Int). Returns the number of bytes received, 0 if no datagram available, or -1 on error (Int).

Network

Parameters & Returns

Parameters

handle Int
buffer Int
maxSize Int

Returns

Int

Quick Summary

Receives a UDP datagram into a buffer. Takes a handle (Int), buffer pointer (Int), and maximum size (Int). Returns the number of bytes received, 0 if no datagram available, or -1 on error (Int).

Technical Exegesis...

Attempts to receive a UDP datagram into the buffer (up to maxSize bytes). Returns the number of bytes received, 0 if no datagram is available (WSAEWOULDBLOCK), or -1 on error. The socket is non-blocking, so it returns immediately if no data is available.

Uses recvfrom to receive the datagram and stores sender's IP and port in global variables accessible via netUDPMsgIP and netUDPMsgPort. Buffer should be large enough for the expected datagram. UDP datagrams are delivered whole or not at all.

Example

Example.bam
; No example implemented yet