c#-网络-IPHostEntry IPAddress-简单实验

代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Diagnostics;

namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            IPHostEntry iPHostEntry = Dns.GetHostEntry("www.baidu.com");
            foreach (IPAddress ip in iPHostEntry.AddressList) {
                string ipaddress = ip.AddressFamily.ToString();
                Console.WriteLine(ipaddress);
                Console.WriteLine(ip.ToString());
            }
            Console.ReadKey();
        }
       
    }
}

运行结果 

c#-网络-IPHostEntry IPAddress-简单实验

上一篇:github官网进不去---解决办法


下一篇:安卓11无线调试功能