qr2_init_socket

GameSpy SDK

qr2_init_socket

Initialize the Query and Reporting 2 SDK.  Allows control over the qr2 socket object.

qr2_error_t qr2_init_socket(
qr2_t * qrec,
SOCKET s,
int boundport,
const gsi_char * gamename,
const gsi_char * secret_key,
int ispublic,
int natnegotiate,
qr2_serverkeycallback_t server_key_callback,
qr2_playerteamkeycallback_t player_key_callback,
qr2_playerteamkeycallback_t team_key_callback,
qr2_keylistcallback_t key_list_callback,
qr2_countcallback_t playerteam_count_callback,
qr2_adderrorcallback_t adderror_callback,
void * userdata );
RoutineRequired HeaderDistribution
qr2_init_socket<qr2.h>SDKZIP

Return Value

This function returns e_qrnoerrorfor a sucessful result.  Otherwise a valid qr2_error_t is returned.

Parameters

qrec
[out] The intialized QR2 SDK object.
s
[in] Socket to be used for query traffic. This socket must have already been initialized.
boundport
[in] The port that the socket was bound to.  Chosen by the developer.
gamename
[in] The gamename, assigned by GameSpy.
secret_key
[in] The secret key for the specified gamename, also assigned by GameSpy.
ispublic
[in] Set to 1 for an internet listed server, 0 for a LAN only server.
natnegotiate
[in] Set to 1 to allow natnegotiated connections.
server_key_callback
[in] Callback that is triggered when server keys are requested.
player_key_callback
[in] Callback that is triggered when player keys are requested.
team_key_callback
[in] Callback that is triggered when team keys are requested.
key_list_callback
[in] Callback that is triggered when the key list is requested.
playerteam_count_callback
[in] Callback that is triggered when the number of teams is requested.
adderror_callback
[in] Calllback that is triggerred when there has been an error adding it to the list.
userdata
[in] Pointer to user data. This is optional and will be passed unmodified to the callback functions.

Remarks

The qr2_init_socket function initializes the qr2 SDK. Instead of creating it’s own internal socket, the qr2 sdk will use the passed in socket for all traffic.  The developer is responsible for receiving on this socket and passing received qr2 messages to qr2_parse_query.

Unicode Mappings

RoutineGSI_UNICODE Not DefinedGSI_UNICODE Defined
qr2_init_socketqr2_init_socketAqr2_init_socketW

qr2_init_socketW and qr2_init_socketA are UNICODE and ANSI mapped versions of qr2_init_socket. The arguments of qr2_init_socketA are ANSI strings; those of qr2_init_socketW are wide-character strings.