[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
/// <summary>
/// 检测网络是否连接
/// </summary>
/// <returns></returns>
public static bool IsConnected()
{
int i = 0;
bool state = InternetGetConnectedState(out i, 0);
return state;
}
C# 检测当前网络状态
猜你喜欢
转载自blog.csdn.net/ThreePointsHeat/article/details/122230551
今日推荐
周排行