using System;
using System.Net;
namespace CSharpIPExample {
class Class1 {
static void Main(string[] args) {
string currentMachine;
IPHostEntry iphe;
currentMachine = Dns.GetHostName();
Console.WriteLine("Host Name: " + currentMachine);
iphe = Dns.GetHostByName(currentMachine);
IPAddress[] ipAddresses = iphe.AddressList;
for (int i = 0; i < ipAddresses.GetUpperBound(0); i++) {
Console.WriteLine("IP Addresses {0} : {1}", i, ipAddresses[i].ToString());
} } } }