标签:div lse int ESS var res rgs cat seconds
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.NetworkInformation; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Ping p = new Ping(); string hostname = "192.168.0.1";//目标IP int timeout = 3000;//超时时间 Stopwatch ws = new Stopwatch(); ws.Start(); var result= p.Send(hostname, timeout); ws.Stop(); if (result.Status == IPStatus.Success) { Console.WriteLine("网络连通"); } else { Console.WriteLine("网络不通"); } Console.WriteLine($"{ ws.ElapsedMilliseconds}"); Console.WriteLine($"{ result.Status}"); Console.ReadLine(); } } }
标签:div lse int ESS var res rgs cat seconds
原文地址:https://www.cnblogs.com/zacklau/p/9543852.html