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
handleInt
bufferInt
maxSizeInt
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.
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. Check return value: 0 = no data, -1 = error, positive = bytes received.