What is the best way to check for Internet connectivity using .NET?

后端 未结 27 2345
感动是毒
感动是毒 2020-11-22 07:41

What is the fastest and most efficient way to check for Internet connectivity in .NET?

27条回答
  •  野性不改
    2020-11-22 08:29

    bool bb = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
    
    if (bb == true)
        MessageBox.Show("Internet connections are available");
    else
        MessageBox.Show("Internet connections are not available");
    

提交回复
热议问题