WRBehning

I have a Server Named "MyServer" with an IP Address of "10.6.3.79"

I'm having a problem with one particular IP Address. If I use Dns.GetHostEntry("MyServer"), I get the IPHostEntry object. If I use Dns.GetHostEntry("10.6.3.79"), I get a SocketException. Finally, if I use the deprecated function Dns.GetHostByName("10.6.3.79"), I get the IPHostEntry object.

I only get the error (as far as I can tell) when I use this one particular IP Address. Does anyone have an idea as to what may be going on

Here is my code:

Example 1:

strHostName = "MyServer";

IPHostEntry iph = Dns.GetHostEntry(strHostName); // Works

Example 2:

strHostName = "10.6.3.79";

IPHostEntry iph = Dns.GetHostEntry(strHostName); // Throws a SocketException {"No such host is known"}

Example 3:

strHostName = "10.6.3.79";

IPHostEntry iph = Dns.GetHostByName(strHostName); // Works



Re: .NET Framework Networking and Communication Dns.GetHostEntry problem

Mariya Atanasova - MSFT

Most probably your DNS server doesn't have an entry for this particular IP address. Try "nslookup 10.6.3.79" from the console and see what result are you getting.

You have to either register this machine with your dns servers or put the entry in your hosts file. Then GetHostEntry will be able to resolve.

I am guessing GetHostByName() will return the same IP address as the name if it fails to resolve.

Mariya





Re: .NET Framework Networking and Communication Dns.GetHostEntry problem

WRBehning

Thanks, I think that is it. nslookup 10.6.3.79 returns with a different name than what I am expecting.

nslookup MyServer returns with the correct name.

I'll have to get with my nework admin guys to get it straightened out.