我正在写,将用于在移动环境中,其中网络连接性将是向上/向下定期的应用程序。我该如何检查一个特定的网络可用?
I'm writing an application that will be used in a mobile environment where network connectivity will be up/down regularly. How do I check to see that a specific network is available?
尝试 NetworkInterface.GetIsNetworkAvailable
:
表示任何网络连接是否可用。
Indicates whether any network connection is available.
一个网络连接被认为是可用的,如果任何网络接口被标记为向上,而不是一个回环或隧道接口。
A network connection is considered to be available if any network interface is marked "up" and is not a loopback or tunnel interface.