Hi.
Scenario:
I’m trying to make a dns lookup with the Dns class. That is: Dns.GetHostEntry(host). The ethernet module has DHCP enabled and gets, among others the dns server 83.255.245.11 as the first in the dns list. There seems to be a problem with this server at the moment and when trying to make a dns lookup to any url I get a query refused error back. So far so good…
The problem:
When trying to resolve an url with the Dns.GetHostEntry method to the errounous dns server I get the following error message:
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (1) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::getaddrinfo [IP: 0000] ####
#### System.Net.Dns::GetHostEntry [IP: 0008] ####
#### Gateway.Communication.RawHttpComm.NTPClient::LoadNTPTime [IP: 0009] ####
#### Gateway.Communication.RawHttpComm.NTPClient::GetNTPTime [IP: 0018] ####
#### Gateway.Time.TimeController::SetTime [IP: 000c] ####
#### Gateway.Program::RunFull [IP: 004a] ####
#### Gateway.Program::Main [IP: 0004] ####
#### SocketException ErrorCode = 10060
LWIP Assertion “DNS response for wrong host name” failed at line 1251 in C:\MicroFrameworkPK_v4_2\DeviceCode\GHI\pal\lwip\lwip_1 3 2\src\api\api_msg.c
The LWIP library seems to throw a correct exception since the dns server obviously don’t work but it is strange that I get a socket timeout exception. Furthermore, the Dns.GetHostEntry does not try to resolve the url with any of the other dns servers that I recieved in the DHCP handshake.
Does anyone experience this same problem?
A possible solution could perhaps be to catch SocketTimeoutExceptions from the Dsn class and set a static dns via the NetworkInterfaceClass (NetworkInterface.EnableStaticDns(“8.8.8.8”)) and then try again?
Is this a bad solution?