Odd IP address

J

John J. Hughes II

I have an application that uses a socket. One of the users was complaining
that it would not work if they put the computer name in but only worked if
they put the IP address in. I had them run the below test program and the
problem was the first IP address is not valid. Obviously I need to do
better checking but does anybody have a clue why such an address would come
back anyway?

CODE:
string HostName = System.Net.Dns.GetHostName();
Console.WriteLine("Host Name: " + HostName);
System.Net.IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(HostName);
foreach (System.Net.IPAddress ipAddress in ipHostInfo.AddressList)
Console.WriteLine(string.Format("IP Address: {0}", ipAddress));

OUTPUT:
C:\>iptest
Host Name: DELL
IP Address: ::1 <---- what is this and why????
IP Address: 192.168.1.7

Regards,
John
 

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