[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;

        }

调用方法:

 

bool state = IsConnected();   //True 为连通   False 为断开

 

 

相关文章:

  • 2022-12-23
  • 2021-06-22
  • 2021-07-22
  • 2021-09-25
  • 2022-12-23
  • 2021-06-23
  • 2022-02-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2021-09-10
  • 2022-12-23
相关资源
相似解决方案