gt2StringToHostInfo

GameSpy SDK

gt2StringToHostInfo

Looks up DNS host information based on a hostname or dotted IP.

const char * gt2StringToHostInfo(
const char * string,
char *** aliases,
unsigned int *** ips );
RoutineRequired HeaderDistribution
gt2StringToHostInfo<gt2.h>SDKZIP

Return Value

The hostname associated with the string, or NULL if no information was available for the host.

Parameters

string
[in] Hostname ("www.gamespy.net") or dotted IP ("1.2.3.4") to lookup.
aliases
[in] On success, the variable passed in will point to a NULL-terminated list of alternate names for the host. Can be NULL.
ips
[in] On success, the variable passed in will point to a NULL-terminated list of alternate IPs for the host. Can be NULL.

Remarks

If the function can successfully lookup the host's info, the host's main hostname will be returned. If it cannot find the host's info, it returns NULL.
For the aliases parameter, pass in a pointer to a variable of type (char **). If this parameter is not NULL, and the function succeeds, the variable will point to a NULL-terminated list of alternate names for the host.
For the ips parameter, pass in a pointer to a variable of type (int **). If this parameter is not NULL, and the function succeeds, the variable will point to a NULL-terminated list of altername IPs for the host. Each element in the list is actually a pointer to an unsigned int, which is an IP address in network byte order.
The return value, aliases, and IPs all point to an internal data structure, and none of these values should be modified directly. Also, the data is only valid until another call needs to use the same data structure (virtually ever internet address function will use this data structure). If the data will be needed in the future, it should be copied off.
This function may need to contact a DNS server, which can cause the function to block for an indefinite period of time. Usually it is < 2 seconds, but on certain systems, and under certain circumstances, it can take 30 seconds or longer.