c#网络相关

测试网络是否通畅:

using System.Net.NetworkInformation;
public bool isNetSuccess(string Destination)
{
Ping pingSender = new Ping();
PingReply reply = null;
try
{
reply = pingSender.Send(Destination, 1000);
}
catch(Exception){}
finally
{
if (reply.Status == IPStatus.Success) 
return true;
else
return false;
}
}

----------

你可能感兴趣的:(c#,网络)