Create a c# program that determine the IP address configuration of a computer
using System;
using System.Net;
namespace ip_adress
{
class Program
{
public static void Main(string[] args)
{
String strHost;
String strIP;
strHost = Dns.GetHostName();
IPAddress[] ipAddress = Dns.GetHostAddresses(strHost);
Console.WriteLine("\nIP address list:");
for (int i=0; i < ipAddress.Length; i++)
{
strIP = Convert.ToString(ipAddress[i]);
Console.WriteLine("IP adress: {0}", strIP);
}
Console.Write("\nPress any key to continue . . . ");
Console.ReadKey(true);
}
}
}
Comments
Leave a comment