我如何检查网络连接? [英] How do I check for a network connection?
本文介绍了我如何检查网络连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是确定是否有可用的网络连接的最佳方式?
What is the best way to determine if there is a network connection available?
推荐答案
您可以为您在.NET 2.0的网络连接使用<一个href=\"http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getisnetworkavailable.aspx\"><$c$c>GetIsNetworkAvailable()$c$c>:
You can check for a network connection in .NET 2.0 using GetIsNetworkAvailable()
:
System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()
要监视的IP地址或网络可用性的变化而变化使用事件从<一个href=\"http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkchange.aspx\">NetworkChange类:
To monitor changes in IP address or changes in network availability use the events from the NetworkChange class:
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged
这篇关于我如何检查网络连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文