|Hint: Use the tree menu to navigate groups of related pages|
[FreeRTOS+TCP API Reference]
uint32_t FreeRTOS_gethostbyname( const uint8_t *pcHostName );
Performs a Domain Name System (DNS) lookup on a host name, returning the hosts IP address. For example, assuming a DNS server replies to the lookup request, a call to FreeRTOS_gethostbyname( “www.freertos.org” ) will return freertos.org’s IP address.
ipconfigUSE_DNS must be set to 1 in FreeRTOSIPConfig.h for FreeRTOS_gethostbyname() to be available.
A DNS lookup can only be performed when FreeRTOS+TCP knows the IP address of a DNS server. If ipconfigUSE_DHCP is 0 in FreeRTOSIPConfig.h then the DNS server address is passed into FreeRTOS+TCP as a parameter of the FreeRTOS_IPInit() function. If ipconfigUSE_DHCP is 1 in FreeRTOSIPConfig.h then the DNS server address can be obtained from a DHCP server.
FreeRTOS_gethostbyname() will wait (in the Blocked state so other tasks can execute) for a reply for 200ms after each DNS request – with a maximum of 5 DNS requests being sent.
A standard NULL terminated string containing the name
of the host being looked up.
If the lookup is successful then the IP address of the host is returned in network byte order.
If the lookup fails then 0 is returned.