using System;
using System.Net; //Network Name space
class FindanIP {
static void Main() {
String HostName = string.Empty; //Read the Host Name.
HostName = Dns.GetHostName();
Console.WriteLine("Local Machine Name: " + HostName);
IPHostEntry ipEntry = Dns.GetHostEntry(HostName); // Using this method we can get Host Name,IP address is obtained.
IPAddress[] addr = ipEntry.AddressList;
for (int i = 0; i < addr.Length; i++) {
Console.WriteLine("IP Address is : " + addr[i].ToString());
}
Console.ReadKey();
}
}This code is used to find the IP address of you computer on C#.
