Get the ip address
Description :
This code shows how to Get the ip address
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);
}
}
}
}
