#include <dolphin/ip.h>
typedef void (* UDPCallback )(UDPInfo* info, s32 result);
s32 UDPReceive ( UDPInfo* info, void* data, s32 len,
IPSocket* local, IPSocket* remote );
s32 UDPReceiveAsync( UDPInfo* info, void* data, s32 len,
IPSocket* local, IPSocket* remote,
UDPCallback callback, s32* result );
UDPReceiveAsync() receives a datagram from the
other end of the socket. If the remote socket has been specified by
UDPConnect(), UDPReceiveAsync()
receives a datagram only from the specified socket.
When the host received a datagram, the callback
will be called. If the received UDP data is too long to fit in the supplied buffer, the rest of the
received datagram data is simply discarded.
info |
Pointer to UDPInfo to transmit a datagram. |
buffer |
The pointer to the receive buffer. Data cache invalidation is not necessary. |
len |
The length of the receive buffer in bytes. |
local |
Optional pointer to IPSocket that receives the destination socket
of the received datagram. |
remote |
Optional pointer to IPSocket that receives the source socket
of the received datagram. |
callback |
Informed when a datagram has been received. |
result |
Optional pointer to s32 that receives the function result.
While the operation is in progress, the value *result
is set to IP_ERR_BUSY. |
IP_ERR_NONE |
Succeeded. |
IP_ERR_INVALID |
info is not a valid UDPInfo. |
IP_ERR_BUSY |
Specified socket is busy. |
IP_ERR_NOT_EXIST |
The local socket has not been specified. |
IP_ERR_DATASIZE |
The data size (len) is less than
zero. |
IP_ERR_SOURCE_QUENCH |
ICMP source quench error |
Note: The specified callback
is not called when the return value of the function is less than zero.
| zero or greater | Succeeded. The number of transferred UDP data bytes. Note it could be
larger than len. |
IP_ERR_CANCELED |
Operation is canceled with UDPCancel(). |
IP_ERR_CLOSING |
info is closed with
UDPClose(). |