modified by ohneta
Dependents: HelloESP8266Interface_mine
Fork of DnsQuery by
Diff: DnsQuery.cpp
- Revision:
- 4:7e64d099f63e
- Parent:
- 3:5705fdae6185
- Child:
- 5:7555d509b568
--- a/DnsQuery.cpp Thu Aug 27 14:33:07 2015 +0000 +++ b/DnsQuery.cpp Tue Nov 10 14:37:17 2015 +0000 @@ -37,14 +37,27 @@ -DnsQuery::DnsQuery(SocketInterface *sock,const char* hostname, char* ipaddress) +DnsQuery::DnsQuery(SocketInterface *sock, const char* hostname, char* ipaddress, const char *dnsIp) { socket = sock; + this->setPreferredDNSServerIP(dnsIp); this->getHostByName(hostname, ipaddress); } +void DnsQuery::setPreferredDNSServerIP(const char *dnsIp) +{ + _preferred_dnsip = dnsIp; +} + bool DnsQuery::getHostByName(const char* hostname, char* resolvedIp) { + if (_preferred_dnsip != NULL) { + _dnsip = (char *)_preferred_dnsip; + if (this->getIP(hostname, resolvedIp)) { + return true; + } + } + char * dnsIPs[] = { "8.8.8.8", "209.244.0.3",