Main Site Documentation

Problem using DNS.GetHostEntry


#1

Hi all,

I am using GetHostEntry function to get the server IP address. It works the first time around, however, it doesnt seem to return the new IP address if the server renews its IP address.

                    
                              hostEntry = Dns.GetHostEntry(serverHostname);
                              serverIPAddress = hostEntry.AddressList[0];

It looks like GetHostEntry caches the value and returns the old one as even if I remove the LAN cable returns the old IP address.
Is there anyway of clearing it or getting around this problem?

I am using a FEZ Cobra with 4.1


#2

Hi andre.m,

I dont think that the DNS function actually re-queries the DNS, it responds with a cached result. How would you explain that even removing the LAN cable still gets the old IP address ?
I will double check with wireshark when i get the chance.

Thanks for replying :slight_smile: