tfDnsGetHostByAddr

Jump to: navigation, search

Table of Contents >> Application Reference >> DNS Resolver


#include <trsocket.h>


int tfDnsGetHostByAddr (
ttUserIpAddress serverIpAddr,
char * hostnameStr,
int hostnameStrLength
);


Function Description

This function retrieves the hostname associated with the given IPv4 address (a "reverse DNS lookup").


Parameters

  • serverIpAddr
    The IPv4 address to retrieve the hostname for.
  • hostnameStr
    The buffer to place the retrieved hostname in.
  • hostnameStrLength
    The length of the buffer to place the retrieved hostname in.


Returns

  • TM_EINVAL
    The hostname string or IP address pointer was invalid.
  • TM_EWOULDBLOCK
    There is currently a DNS lookup in progress. The user should continue to call tfDnsGetHostByAddr() with the same parameters until it returns a value other than TM_EWOULDBLOCK. This is only returned when the resolver is operating in non-blocking mode.
  • TM_EFILE
    Treck was unable to successfully allocate a socket for the DNS request. This could indicate Treck did not have the resources to allocate another socket. It could also be due to Treck hitting the limit of sockets set by TM_DNS_MAX_SOCKETS_ALLOWED or the tfDnsSetOption() option: TM_DNS_OPTION_MAX_SOCKETS_ALLOWED.
  • TM_ENOERROR
    The DNS lookup was successful and the hostname has been stored in hostnameStr and the length of the hostname has been stored in hostnameStrLength.


Table of Contents >> Application Reference >> DNS Resolver