gt2IPToHostInfo
Looks up DNS host information based on an IP.
- const char * gt2IPToHostInfo(
- unsigned int ip,
- char *** aliases,
- unsigned int *** ips );
Routine | Required Header | Distribution |
---|---|---|
gt2IPToHostInfo | <gt2.h> | SDKZIP |
Return Value
The hostname associated with the IP, or NULL if no information was available for the host.
Parameters
- ip
- [in] IP to look up, in network byte order.
- aliases
- [out] On success, the variable passed in will point to a NULL-terminated list of alternate names for the host. Can be NULL.
- ips
- [out] 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.
Section Reference: Gamespy Transport SDK
See Also: gt2StringToHostInfo, gt2IPToHostname, gt2IPToAliases, gt2IPToIPs