SBServerGetConnectionInfo

GameSpy SDK

SBServerGetConnectionInfo

Checks if Nat Negotiation is required, based off whether it is a LAN game, a public IP is present and several other factors. Fills a supplied pointer with an IP string to use for Nat Negotiation, or a direct connection if possible.

SBBool SBServerGetConnectionInfo(
ServerBrowser gSB,
SBServer server,
gsi_u16 portToConnectTo,
char * ipstring_out );
RoutineRequired HeaderDistribution
SBServerGetConnectionInfo<sb_serverbrowsing.h>SDKZIP

Return Value

Returns SBTrue if Nat Negotiation is required, SBFalse if not.

Parameters

gSB
[in] ServerBrowser object returned from ServerBrowserNew.
server
[in] A valid SBServer object.
portToConnectTo
[in] The game port to connect to.
ipstring_out
[out] An IP String you can use for a direct connection, or to attempt Nat Negotiation with.

Remarks

The connection test will result in one of three scenarios, based upon the return value of the function.

Returns SBFalse:
1) LAN game - connect using the IP string.
2) Internet game with a direct connection available - connect using the IP string.

Returns SBTrue:
3) Nat traversal required, perform Nat Negotiation with the IP string before connecting.

Section Reference: Gamespy Server Browsing SDK