InitStatsAsync

GameSpy SDK

InitStatsAsync

Initializes the Tracking Server Connection Without Blocking.

int InitStatsAsync(
int gameport,
gsi_time timeout );
RoutineRequired HeaderDistribution
InitStatsAsync<gstats.h>SDKZIP

Return Value

GE_NOERROR if successful; otherwise one of the GE_ error codes. See Remarks.

Parameters

gameport
[in] The game port that the host is running on.
timeout
[in] Optional timeout for the connection attempt. (See Remarks)

Remarks

InitStatsThink will need to be called while the connection attempt is in progress.

Be sure to set the global "gcd_gamename" and "gcd_secret_key" variables to your gamename and secret key before making this call or you will be unable to connect to the tracking server.

If your game doesn’t use multiple ports (or doesn’t support more than one host per machine) then you can just use 0 for the gameport.

A optional timeout value may be supplied to control how long the SDK will attempt to connect. The connection attempt will abort after the elapsed time. The connection attempt may be aborted at any time by calling CloseStatsConnection.

Error return values include:
GE_NODNS: Unable to resolve stats server DNS
GE_NOSOCKET: Unable to create data socket
GE_NOCONNECT: Unable to connect to stats server
GE_DATAERROR: Unable to receive challenge from stats server, or bad challenge
GE_NOERROR: Connected to stats server and ready to send data
GE_CONNECTING: Connect did not immediately complete. Call InitStatsThink to continue.
GE_TIMEOUT: Connect did not complete before timeout value was reached.