特定的网络接口的IPv4的可用性 - 无连接,本地互联网 [英] Specific network interface IPv4 availability - No connectivity, Local, Internet
本文介绍了特定的网络接口的IPv4的可用性 - 无连接,本地互联网的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
NetworkInterface[] nets = NetworkInterface.GetAllNetworkInterfaces();
foreach (var n in nets)
{
// TODO: determine connectivity status of each network interface
// ( mainly interested in IPv4 connectivity )
}
- 在这个问题的不是一般的互联网连接,因此使用说<一href="http://stackoverflow.com/questions/6411145/how-to-check-inernet-connectivity-for-pc"><$c$c>GetIsNetworkAvailable()$c$c>是不是解决
- <一个href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.operationalstatus.aspx"相对=nofollow>
OperationalStatus.Up
可以用来过滤掉一些不活动的网络接口,但不是全部 - OperationalStatus.Up留下一些这显示无网络连接作为IPv4和IPv6 接口
- 我也知道<一个href="http://stackoverflow.com/questions/151231/how-do-i-get-the-local-network-ip-address-of-a-computer-programmatically-c/151349#151349">how获得的IPv4
UnicastAddresses
,那么是什么/是有用的? - 在我没有找到相关的<一个什么href="http://stackoverflow.com/questions/359596/identifying-active-network-interface-in-net/359640#359640">these WMI 的部分
- This question is not about general internet connectivity and as such using say
GetIsNetworkAvailable()
is not a solution OperationalStatus.Up
can be used to filter out some inactive network interfaces, but not all - OperationalStatus.Up leaves in some interfaces that show "No network access" for both IPv4 and IPv6- I'm also aware how to get the IPv4
UnicastAddresses
, but then what / is that useful? - I could not find anything relevant in these sections of WMI
推荐答案
我觉得你上面显示的对话框微软使用是通过编码对网络位置感知API获得的信息。
I think the Microsoft dialog you show above is using information gained by coding against the Network Location Awareness API.
http://msdn.microsoft。 COM / EN-US /库/ ee264321%28V = VS.85%29.aspx
这篇关于特定的网络接口的IPv4的可用性 - 无连接,本地互联网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文