IPHostEntry.AddressList : IPHostEntry « System.Net « C# / C Sharp by API






IPHostEntry.AddressList

 

using System;
using System.Net;

class MainClass
{
   public static void Main()
   {
      string hostName = Dns.GetHostName();
      Console.WriteLine("Local hostname: {0}", hostName);
      IPHostEntry myself = Dns.GetHostByName(hostName);
      foreach (IPAddress address in myself.AddressList)
      {
         Console.WriteLine("IP Address: {0}", address.ToString());
      }
   }
}

   
  








Related examples in the same category

1.IPHostEntry.Aliases
2.IPHostEntry.HostName