using System;
using System.Net;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            IPHostEntry ipHost = Dns.GetHostEntry(Dns.GetHostName());     //v6地址
      //      IPHostEntry ipHost = Dns.GetHostByName(Dns.GetHostName());      //v4地址
            IPAddress ipAddr = ipHost.AddressList[0];

            Console.Write(ipAddr.ToString());
            Console.Read();
        }      
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-12-22
  • 2022-12-23
  • 2021-05-11
  • 2022-02-18
猜你喜欢
  • 2022-12-23
  • 2022-03-06
  • 2021-07-13
  • 2021-09-21
  • 2022-12-23
  • 2021-05-09
相关资源
相似解决方案