err_t netconn_gethostbyname ( const char * aName, struct ip_addr * aAddr );
  • in aName: DNS name to be resolved
  • out aAddr: the IP address belonging to the DNS name
  • return: ERR_OK on success or some error code

This function is a wrapper over "dns_gethostbyname", providing a higher lever alternative. The call blocks until either the IP is resolved (result = ERR_OK) or time-out.

Note that no netconn-object is required for this function.

Defines afflecting the DNS client:

#define LWIP_DNS                 1  // must be 1 for DNS support, default 0
#define DNS_TABLE_SIZE           2  // number of table entries, default 4
#define DNS_MAX_NAME_LENGTH     32  // max. name length, default 256
#define DNS_MAX_SERVERS          2  // number of DNS servers, default 2
#define DNS_DOES_NAME_CHECK      1  // compare received name with given,def 0 
#define DNS_MSG_SIZE           512

In versions prior to 1.4.0 one more define is available:

#define DNS_USES_STATIC_BUF      2     // 0, 1 or 2, default 1
// 0 = local buffer
// 1 = static buffer
// 2 = dynamic bufffer of size DNS_MSG_SIZE

Please make sure you define DNS_TABLE_SIZE and DNS_MSX_SERVERS big enough. Otherwise a given name might not be resolved because the corresponding DNS-server is not in the list and thus can't be invoked. See also DNS.

(last change: 14.06.2011)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.