gt2AddressToString

GameSpy SDK

gt2AddressToString

Converts an IP and a port into a text string.

const char * gt2AddressToString(
unsigned int ip,
unsigned short port,
char string[22] );
RoutineRequired HeaderDistribution
gt2AddressToString<gt2.h>SDKZIP

Return Value

The string is returned. If the string paramater is NULL, then an internal static string will be used. There are two internal strings that are alternated between.

Parameters

ip
[in] IP in network byte order. Can be 0.
port
[in] Port in host byte order. Can be 0.
string
[out] String will be placed in here. Can be NULL.

Remarks

The IP must be in network byte order, and the port in host byte order. The string must be able to hold at least 22 characters (including the NUL).
"123.123.123.123:12345"
If both the IP and port are non-zero, the string will be of the form "1.2.3.4:5" ("<IP>:<port>").
If the port is zero, and the IP is non-zero, the string will be of the form "1.2.3.4" ("<IP>").
If the IP is zero, and the port is non-zero, the string will be of the form ":5" (":<port>").
If both the IP and port are zero, the string will be an empty string ("").

Section Reference: Gamespy Transport SDK

See Also: gt2StringToAddress