Answer to Question #327920 in C# for Joe lens

Question #327920

Create a c# program that determine the IP address configuration of a computer

1
Expert's answer
2022-04-12T16:15:20-0400
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);
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS