Get the IP and Family of Systerm

Description :


Get the IP and Family of Systerm

Namespace used

using System;
using System.Net;



Following is the code to get the family ,ip address of the computer


namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
foreach (string computername in args)
{
try
{
IPAddress[] IPaddresses = Dns.GetHostEntry(computername).AddressList;
foreach (IPAddress Myaddress in IPaddresses)
{
Console.WriteLine("{0} = {1} ({2})",
computername, Myaddress, Myaddress.AddressFamily);
}
}
catch (Exception ex)
{
Console.WriteLine("{0} = Error ({1})", computername, ex.Message);
}
}


}
}
}




By
Nathan


Comments

Author: Alok Sheth01 Aug 2009 Member Level: Bronze   Points : 0

Thanks Nathan

Nice information.

Appreciative your work.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: