#include <dolphin/ip.h>
typedef void (* TCPCallback )(TCPInfo* info, s32 result);
s32 TCPReceive ( TCPInfo* info, void* buffer, s32 len );
s32 TCPReceiveAsync ( TCPInfo* info, void* buffer, s32 len,
TCPCallback callback, s32* result );
s32 TCPReceiveUrg ( TCPInfo* info, void* buffer, s32 len );
s32 TCPReceiveUrgAsync( TCPInfo* info, void* buffer, s32 len,
TCPCallback callback, s32* result );
TCPReceiveAsync() attempts to read
len bytes from the
other end of the connection. When the host received data, the callback will be
called.
TCPReceiveUrgAsync() attempts to read the urgent byte sent from
the other end of the connection with
TCPSendUrgAsync(). The specified callback will be called when the connection
receives segments with the urgent pointer set even before the urgent byte is
received.
Note: The current implementation assumes that the urgent pointer points to the sequence number of the last + 1 octet in a sequence of urgent data as Berkeley derived system does.
info |
Pointer to TCPInfo to receive data. |
buffer |
The pointer to the receive buffer. Data cache invalidation is not necessary. |
len |
The length of the receive buffer in bytes. |
callback |
Informed when data has been received. |
result |
Optional pointer to s32 that receives the function result. |
| zero or greater | Succeeded. The number of transferred bytes. |
IP_ERR_INVALID |
info is not a valid TCPInfo. |
IP_ERR_NOT_EXIST |
Connection does not exist. |
IP_ERR_CLOSING |
Connection closing. |
IP_ERR_BUSY |
Specified socket is busy. |
IP_ERR_NETDOWN |
Local network interface is down. |
IP_ERR_AGAIN |
There is no data or out-of-band data waiting to be received. |
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 bytes. |
IP_ERR_RESET |
Connection reset |
IP_ERR_REFUSED |
Connection refused |
IP_ERR_TIMEOUT |
Connection timeout |