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# 检查网络是否连通,判断远程文件是否存在)