using System;
using System.Net;
Code:
static void Main(string[] args)
{
Get Host Name
string host = Dns.GetHostName();
Console.WriteLine("Hostname is: {0}", host);
GetIP Entry
IPHostEntry entry = Dns.GetHostByName(host);
foreach (IPAddress ip in entry.AddressList)
{
Console.WriteLine("IP address: " + ip.ToString());
}
}
0 comments:
Post a Comment