DWC_ConnectToGameServerAsync

Syntax

#include <dwc.h>

BOOL DWC_ConnectToGameServerAsync(DWCTopologyType topology,
                                  int serverIndex,
                                  DWCMatchedSCCallback matchedCallback,
                                  void *matchedParam,
                                  DWCNewClientCallback newClientCallback,
                                  void *newClientParam,
                                  DWCConnectAttemptCallback attemptCallback,
                                  u8 *connectionUserData,
                                  void *attemptParam);

Arguments

topology The connection topology. Specified from inside DWCTopologyType.
serverIndex Friend roster index on the destination server host.
matchedCallback Pointer to the connection completion callback function. This is called for each person who connects.
matchedParam Parameter for the connection completion callback.
newClientCallback Pointer to the new connection client notification callback function.
newClientParam Parameter for the new connection client notification callback function.
attemptCallback Pointer to the connection acceptance callback function.
connectionUserData Pointer to the local host's own connection acceptance parameter buffer. This must be buffer of length u8[DWC_CONNECTION_USERDATA_LEN]. The buffer’s contents will be copied to the library, so it can be deallocated once this function is called. If NULL is specified, zeros are set for the entire content of the local buffer that is used for determining whether to accept a connection.
attemptParam Parameter for the connection acceptance callback.

Return Values

TRUE The process starts. The results are indicated via the callback function.
FALSE Not a good state for calling this function.

Description

This function specifies the server host to connect to using the index on the friend roster and then connects there. The server host is the host that waits for connections from client hosts after calling the DWC_SetupGameServer function as part of server-client matchmaking. If the DWC_ProcessFriendsMatch function is called continuously after calling this function, the matchmaking process will progress. The matchmaking completion callback is called if the matchmaking completes with a success, error, or cancellation.

A new connection client notification callback is called when at least one client host has already connected to the server host and a new client host arrives to connect to the server host. Once this new client successfully connects, the matchmaking completion callback is called again, as well.

Depending on the condition of the network connection, the process might be blocked and not return from the function for some time.

Because there are cases in which DWCMatchedSCCallback is not called, an appropriate timeout should be established on the application side. The duration of the timeout should be roughly two to three times of what it normally takes to connect.

Revision History

2.0.0
Specification change.
1.4.10
Added a section concerning the details of connecting to the network.
1.4.16
Added a caution stating that DWCMatchedSCCallback may not always be called.

CONFIDENTIAL