tfDnsGetHostByName
Table of Contents >> Application Reference >> DNS Resolver
#include <trsocket.h> |
int tfDnsGetHostByName | ( |
const char * hostnameStr, | |
ttUserIpAddressPtr ipAddressPtr | |
); |
Function Description
This function retrieves an IPv4 address associated with the given hostname.
Parameters
- hostnameStr
- Hostname to resolve.
- ipAddressPtr
- Set to the IPv4 address of the host.
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 tfDnsGetHostByName() 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_ETIMEDOUT
- The DNS lookup failed because it exceeded the allowed number of retries.
- TM_ENOERROR
- The DNS lookup was successful and the IP address is stored in ipAddressPtr.