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).
Re: Get DNS Server IP
Postby Her Mary » 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) {
case EVENT_STAMODE_GOT_IP:
os_printf("ip:" IPSTR ",mask:" IPSTR ",gw:" IPSTR,
IP2STR(&evt->event_info.got_ip.ip),
IP2STR(&evt->event_info.got_ip.mask),
IP2STR(&evt->event_info.got_ip.gw));
os_printf("\n");
break;
default:
break;
}
}
void user_init(void)
{
// TODO: add your own code here....
wifi_set_event_handler_cb(wifi_handle_event_cb);
}
Who is online
Users browsing this forum: No registered users and 60 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.