Skip to content

Commit 92571aa

Browse files
committed
Merge pull request #902 from martinayotte/esp8266
add dnsIP() to ESP8266WiFi class
2 parents 2aa4bba + d762543 commit 92571aa

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,12 @@ IPAddress ESP8266WiFiClass::gatewayIP()
370370
return IPAddress(ip.gw.addr);
371371
}
372372

373+
IPAddress ESP8266WiFiClass::dnsIP(int dns_no)
374+
{
375+
ip_addr_t dns_ip = dns_getserver(dns_no);
376+
return IPAddress(dns_ip.addr);
377+
}
378+
373379
String ESP8266WiFiClass::SSID() const
374380
{
375381
static struct station_config conf;

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h

+7
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ class ESP8266WiFiClass
168168
*/
169169
IPAddress gatewayIP();
170170

171+
/*
172+
* Get the DNS ip address.
173+
*
174+
* return: DNS ip address value
175+
*/
176+
IPAddress dnsIP(int dns_no = 0);
177+
171178
/*
172179
* Return the current SSID associated with the network
173180
*

0 commit comments

Comments
 (0)