DNS.GetHostEntry problems

  • Thread starter The Grim Reaper
  • Start date
T

The Grim Reaper

Hi all,

I have a small "irritant" to do with DNS resolving in .NET Framework v2.0.

For this example, assume the following network information;
Local IP address is 192.168.0.10, on a PC named "PC_01"
Remote address is 192.168.0.20, on a local LAN, and named "PC_02"

DNS.GetHostByAddress("192.168.0.20").Hostname returns "PC_02"
DNS.Resolve("192.168.0.20").Hostname returns "PC_02"

Both these methods are marked obsolete in v2.0 of the framework, and
GetHostEntry is recommended as the replacement. However;

DNS.GetHostEntry("192.168.0.20").Hostname returns "192.168.0.20" .....
not the hostname!!

The only other thing I've noticed is that
DNS.GetHostEntry("192.168.0.10").Hostname returns "PC_01", so it seems to
work on the local node.

Anyone got any idea why!??! Is it just an annoying but in GetHostEntry()??
:(
 
T

The Grim Reaper

Oh - and while I'm at it.. if anyone else comes across this particular bit
of code, the way round it is to configure a hosts file for your network.
Not ideal if you've got DHCP and constantly changing IP addresses.. but it
works.
__________________________________________
The Grim Reaper
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top