How to identify if the Network Interface is LAN or Wifi or External

前端 未结 2 425
小鲜肉
小鲜肉 2021-01-21 17:58

I want to differentiate between the Ethernets available on my system. Whether that\'s a LAN , Wifi or something created by VMWare. I am only intrested for LAN.

相关标签:
2条回答
  • 2021-01-21 18:07

    Look at using WMI to retrieve more detailed information about network adapters on the system. It'll tell you whether or not a given adapter is a wired network adapter or wireless, and if it is indeed a 'physical' network adapter.

    http://geekswithblogs.net/PsychoCoder/archive/2008/01/25/using_wmi_in_csharp.aspx

    http://msdn.microsoft.com/en-us/library/windows/desktop/aa394216(v=vs.85).aspx

    0 讨论(0)
  • 2021-01-21 18:08

    To find out if the adapter is a Wifi adapter you can use the MSNdis_PhysicalMediumType class in the root\WMI namespace.

    Unfortunately the VMware adapters appear to Windows as if they are "real" physical adapters and have a MAC address and IP address etc so it's hard to differentiate those.

    You'll notice in Windows if you run ncpa.cpl they all appear the same as physical adapters.

    0 讨论(0)
提交回复
热议问题