Main Site Documentation

Bug in DNS.GetHostEntry ? Doesnt retrieve changed DNS info


#1

Hi,

I am having some issues where the GetHostEntry function doesn’t return the NEW ip address after a DNS change has been done.

I have verified using NSLOOKUP on a PC against the same DNS server that the GHI module is using, and I get different results.

For me it looks like the System.dll function GetHostEntry caches the value and returns the old one…

This behaviour has been identified in 3.x runtime and in the latest 4.1 runtime.
Even changing DNS server in code - to point to another DNS server that also has the new value - doesnt help - it returns the old value.

Hell, even after removing the LAN cable the function returns the old value…

Please advice.

Best regards,
Ronny


#2

If this is true, the fix is not simple. This would be something got be covered in 4.2, which may have this fixed already.


#3

I’m swithcing to MSchwarz.Net.Dns.DnsResolver to get the functionality I need…


#4

Interesting. Perhaps you could check the actual ethernet packet DNS query using netmon or wireshark to see if it’s even transmitted and if the correct response is returned from DNS but ignored in netmf.


#5

Try to reinitialize the whole networking stack.

We have this method, this might do that.
Ethernet.Enable();


#6

Brett,

I dont think that the DNS function actually re-queries the DNS server, it responds with a cached result.
How would you explain that even removing the LAN cable still gets the old IP address ?

And Joe,
I am afraid of doing this as I may have other TCP connections open that may get interruped.


#7

[quote]And Joe,
I am afraid of doing this as I may have other TCP connections open that may get interruped.
[/quote]

That’s for sure. This will stop all ongoing networking activities.

The other solution is that you make your own DNS class using UDP socket. It is should be simple to implement.