Get DNS Server IP

Posts: 1
Joined: Wed Feb 01, 2017 9:56 pm

Get DNS Server IP

Postby guruschmuru » Wed Feb 01, 2017 10:23 pm

It would be very useful to have access to the DNS server addresses assigned to the DHCP client when the ESP8266 is connected in STA mode. Ideally these addresses would either be returned in the ip_info struct via wifi_get_ip_info or alternatively via a dedicated API (for example espconn_dns_getserver).

Her Majesty
Posts: 248
Joined: Mon Oct 27, 2014 11:09 am

Re: Get DNS Server IP

Postby Her Majesty » Fri Mar 24, 2017 1:18 pm

Maybe call API wifi_set_event_handler_cb, the gateway in event EVENT_STAMODE_GOT_IP can be used.

Code: Select all

void wifi_handle_event_cb(System_Event_t *evt)
   os_printf("event %x\n", evt->event);
   switch (evt->event) {
          os_printf("ip:" IPSTR ",mask:" IPSTR ",gw:" IPSTR,
void user_init(void)
    // TODO: add your own code here....

Who is online

Users browsing this forum: Bing [Bot] and 9 guests