[DllImport("wininet.dll")] private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue); public bool IsInternetConnected() { int i = 0; return InternetGetConnectedState(out i, 0); }http://www.codeproject.com/KB/cpp/CC_ConnectionStatePackage.aspx
private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
public bool IsInternetConnected()
{
int i = 0;
return InternetGetConnectedState(out i, 0);
}http://www.codeproject.com/KB/cpp/CC_ConnectionStatePackage.aspx
这是看网络状态的正解,对与楼主的需求加个Timer实时临控一下就可以了