Get Host By Name, Get Host Name

image_pdfimage_print
   
  


using System;
using System.Net;
class AddressSample {
    public static void Main() {
        IPHostEntry ihe =  Dns.GetHostByName(Dns.GetHostName());
        IPAddress myself = ihe.AddressList[0];

        Console.WriteLine("The NONE address is: {0}",myself);
    }
}

   
     


This entry was posted in C# Network. Bookmark the permalink.