DWC_SendReliable

Syntax

#include <dwc.h>

BOOL DWC_SendReliable(u8 aid,
                      const void *buffer,
                      int size);

Arguments

aid AID of the send destination.
buffer Pointer to the send buffer.
size Size of the send buffer.

Return Values

TRUE Storing the data in the send buffer succeeded.
FALSE Storing the data in the send buffer failed.
Either an error has occurred, the previous send process has not ended, an invalid AID was specified, or there is not enough space in the send buffer.

Description

After matchmaking completes, performs a reliable transfer to the partner specified by aid.

Reliable transfers use UDP, but implementation at the library level ensures that data is received by the other party in the order it was sent, without duplicating or dropping packets. However, because packet arrival is confirmed for each transfer, this takes more time than unreliable transfers, which do not confirm packet arrival.

When data is sent using this function, it is temporarily saved as described below. Do not change the content of the send data (buffer) during this time. To determine if send data can be changed, use either the DWC_IsSendableReliable function to check whether reliable transfer is possible in the current state, or the send completion callback mentioned below to check whether the transfer has completed.

The data sent using this function will be stored in a send buffer of the size specified by the DWC_InitFriendsMatch function until it is confirmed that the data has been received. If there is not enough free space in this buffer, the data that did not fit will be stored temporarily and sent consecutively within the DWC_ProcessFriendsMatch function as soon as free space become available. This function returns FALSE if there is no free space at all in this buffer.

A single packet up to a fixed maximum size (1,465 bytes by default) can be sent. Data of larger size will be split up internally when it is sent. The data that is left after being split will be saved temporarily before it is sent consecutively in the DWC_ProcessFriendsMatch function.

The maximum data size can be changed using the DWC_SetSendSplitMax function. However, to maintain compatibility with communication devices of various configurations, the data size should not be set to a value larger than the default.

In addition, when there is a send completion callback configured with the DWC_SetUserSendCallback function, the callback is called when the sending of data has finished. However, in this case, saying that transmission is complete means that data has been stored in the send buffer, not that it has been received by the communication partner.

To get the AID list of the connected communication partner, use the DWC_GetAIDList function.

Revision History

1.4.20
Added a precaution about the timing of send buffer rewrites.

CONFIDENTIAL