gt2ConnectAttemptCallback

GameSpy SDK

gt2ConnectAttemptCallback

This notifies the socket that a remote system is attempting a connection.

typedef void (*gt2ConnectAttemptCallback)(
GT2Socket socket,
GT2Connection connection,
unsigned int ip,
unsigned short port,
int latency,
GT2Byte * message,
int len );
RoutineRequired HeaderDistribution
gt2ConnectAttemptCallback<gt2.h>SDKZIP

Parameters

socket
[in] The handle to the socket.
connection
[in] The handle to the connection.
ip
[in] The IP (network byte order) from which the connect attempt is coming.
port
[in] The port (host byte order) from which the connect attempt is coming
latency
[in] estimate of the round-trip time between the two machines (in milliseconds).
message
[in] Optional initial data sent with the connect attempt. May be NULL.
len
[in] Length of the initial data. May be 0.

Remarks

The IP and port of the remote system is provided, along with an optional initial message, and a latency estimate. These can be used to validate/authenticate the connecting system. This connection must either be accepted with gt2Accept, or rejected with gt2Reject. These can be called from within this callback, however they do not need to be. They can be called at any time after this callback is received. This is very useful for systems that need to check with another machine to authenticate the user (such as for a CDKey system). The latency is only an estimate, however it can be used for things such as only allowing low-ping or high-ping users onto a server.