【分享】C#如何快速判断系统是否已经联网?
using System.Net.NetworkInformation;
public bool IsConnected()
{
Ping ping = new Ping ();
PingReply reply = ping.Send("www.baidu.com");
return (reply.Status == IPStatus.Success);
}
using System.Net.NetworkInformation;
public bool IsConnected()
{
Ping ping = new Ping ();
PingReply reply = ping.Send("www.baidu.com");
return (reply.Status == IPStatus.Success);
}