C# 判断网络是否正常

C# 判断网络是否正常

[DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);

        private bool IsConnected()
        {
            int i = 0;
            bool state = InternetGetConnectedState(out i, 0);
            return state;
        }

 

你可能感兴趣的:(C# 判断网络是否正常)