Bug in DNS.GetHostEntry ? Doesnt retrieve changed DNS info

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

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.

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

http://netmicroframework.blogspot.com/2009/02/3-examples-using-mschwarznetdns.html

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.

Try to reinitialize the whole networking stack.

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

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.

[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.