gt2PingCallback

GameSpy SDK

gt2PingCallback

This callback is called when a response to a ping sent on this connection is received.

typedef void (*gt2PingCallback)(
GT2Connection connection,
int latency );
RoutineRequired HeaderDistribution
gt2PingCallback<gt2.h>SDKZIP

Parameters

connection
[in] The handle to the connection.
latency
[in] The round trip time of the ping, in milliseconds.

Remarks

This callback gives a measure of the time it takes for a datagram to make a round-trip from one connection to the other. The latency reported in this callback will typically be larger than that reported by using ICMP pings between the two machines (the "ping" program uses ICMP pings), because ICMP pings happen at a lower level in the operating system. However, the ping reported in this callback will much more accurately reflect the latency of the application, as the application’s messages must go through the same path as these pings, as opposed to ICMP.
Because pings are unreliable, a ping sent with gt2Ping is not guaranteed to make it through the entire round-trip. So not every call to gt2Ping will result in this callback being called. In addition, unreliable messages may be repeated (although this is a very rare occurrence), which means this callback could be called multiple times for a single call to gt2Ping.

Section Reference: Gamespy Transport SDK

See Also: gt2Ping