I want to programmatically select the network card that is connected to the Internet. I need this to monitor how much traffic is going through the card. This is what I use to get the instance names
var category = new PerformanceCounterCategory("Network Interface");
String[] instancenames = category.GetInstanceNames();
And this how instancenames looks on my machine
[0] "6TO4 Adapter"
[1] "Internal"
[2] "isatap.{385049D5-5293-4E76-A072-9F7A15561418}"
[3] "Marvell Yukon 88E8056 PCI-E Gigabit Ethernet Controller"
[4] "isatap.{0CB9C3D2-0989-403A-B773-969229ED5074}"
[5] "Local Area Connection - Virtual Network"
[6] "Teredo Tunneling Pseudo-Interface"
I want the solution to be robust and work on other PCs, I would also prefer .NET. I found other solutions, but they seem to be more complicated for the purpose
- Use C++ or WMI
- Parse output of netstat
Is there anything else?
See that I already mentioned some available solutions. I am asking if there is anything else, more simple and robust (i.e. NOT C++, WMI or parsing console application output)