InitStatsConnection

GameSpy SDK

InitStatsConnection

Initializes the Tracking Server Connection.

int InitStatsConnection(
int gameport );
RoutineRequired HeaderDistribution
InitStatsConnection<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.

Remarks

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.

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.