[英]How can i discover the network adapter that exist on my machine?
In my application i need to check if some network adapter ( that plug in using USB ) is connected. 在我的应用程序中,我需要检查是否连接了某些网络适配器(使用USB插入)。 When this plug in is connected i see the new hardware as network adapter and i need to start to using it -
连接此插件后,我将新硬件视为网络适配器,我需要开始使用它-
How can i know in run time is the new hardware is connected ? 我如何在运行时知道是否已连接新硬件?
PS: I need to do it using .net framework 2.0 PS:我需要使用.net framework 2.0来做
Thanks. 谢谢。
You can enumerate all the network interfaces on your local machine with 您可以使用以下方法枚举本地计算机上的所有网络接口:
System.Net.NetworkInformation.GetAllNetworkInterfaces() System.Net.NetworkInformation.GetAllNetworkInterfaces()
This may give you enough information to determine if the network adapter has been attached. 这可能会给您足够的信息来确定是否已连接网络适配器。
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getallnetworkinterfaces.aspx http://msdn.microsoft.com/zh-cn/library/system.net.networkinformation.networkinterface.getallnetworkinterfaces.aspx
I think that you should take a look at WMI events. 我认为您应该看一下WMI事件。 If system broadcast information about hardware being connected, it will do it through WMI
如果系统广播有关所连接硬件的信息,它将通过WMI进行操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.