SDLNet_ResolveIP -- Get hostname from an IPaddress


const char *SDLNet_ResolveIP(IPaddress *address)


SDLNet_ResolveIP resolve the IPv4 numeric address in address->host, and return the hostname as a string.

Return Value

Returns a valid char pointer (string) on success. the returned hostname will have host and domain, as in "host.domain.ext". NULL is returned on errors, such as when it's not able to resolve the host name. The returned pointer is not to be freed. Each time you call this function the previous pointer's data will change to the new value, so you may have to copy it into a local buffer to keep it around longer.


// resolve the host name of the address in ipaddress
//IPaddress ipaddress;
const char *host;
if(!(host=SDLNet_ResolveIP(&ipaddress))) {
    printf("SDLNet_ResolveIP: %s\n", SDLNet_GetError());

See Also

SDLNet_ResolveHost, IPaddress

SDLNet_ResolveIP (last edited 2008-04-17 08:18:45 by localhost)