c# - Weird network devices -
i using networkinformation namespace list network devices.
networkinterface.getallnetworkinterfaces();
when list, there weird unknown devices:
what they? , should i, , if, how, rid of them? in theory should show local area connection , wireless connection. under network connections can't find installed either.
windows has network 'devices' don't exist in terms of physical hardware - they're used various things, such vpn connections (like tunneling pseudo interface) , loopback adapter, responds 127.0.0.1
you can parse non-physical addresses using wmi query list of adapters instead,
using (managementobjectsearcher searcher = new managementobjectsearcher(new selectquery("win32_networkadapter"))) { foreach (managementobject mo in searcher.get()) { if ((bool)mo["physicaladapter"]) console.writeline(mo["name"]); } }
(taken msdn)
that'll return physical devices, you're casting true/false value of physicaladapter property bool.
Comments
Post a Comment