C# 实现ping功能

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
  
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping();
            System.Net.NetworkInformation.PingOptions option = new System.Net.NetworkInformation.PingOptions();
            option.DontFragment = true;
            string data = "123456789";
            byte[] buffer = Encoding.ASCII.GetBytes(data);
  
            int timeout = 1000;
            for (int i = 0; i < 1000; i++)
            {
                System.Net.NetworkInformation.PingReply reply = p.Send("kcs001", timeout);
                Console.WriteLine(reply.Status.ToString());
            }
        }
          
    }
}