TCPSend[Async]


C Specification

#include <dolphin/ip.h>

typedef void (* TCPCallback )(TCPInfo* info, s32 result);

s32 TCPSend         ( TCPInfo* info, const void* data, s32 len );
s32 TCPSendAsync    ( TCPInfo* info, const void* data, s32 len,
                      TCPCallback callback, s32* result );

s32 TCPSendUrg      ( TCPInfo* info, const void* data, s32 len );
s32 TCPSendUrgAsync ( TCPInfo* info, const void* data, s32 len,
                      TCPCallback callback, s32* result );

Description

TCPSendAsync() transmits the len bytes of data to the other end of the connection. The callback will be called when all the specified data are copied to the send buffer specified with TCPOpen(). Until then, the data should be kept untouched.

TCPSendUrgAsync() sends segments to the destination with the urgent pointer set. The receiver will be notified of the urgent condition. To send urgent data, len must be greater than one.

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. 

Arguments

info Pointer to TCPInfo to transmit data.
data The pointer to the data. Any data cache flush or store operation is not necessary.
len The length of the data in bytes. To send urgent data, len must be greater than one.
callback Informed when the whole data has been copied to the send buffer.
result Optional pointer to s32 that receives the function result.

Return Values

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_SOCKET_UNSPECIFIED Remote socket unspecified.
IP_ERR_NETDOWN Local network interface is down.

Callback specific result values

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

See Also