I'm writing a program in C# that needs to monitor the amount of internet bandwidth currently in use so it can do a background upload when the internet usage is low. How can I automatically determine which network adapter is the one connected to the internet?
Right-click the wireless adapter and select Properties. Click the Driver tab to see the wireless adapter property sheet. The Wi-Fi driver version number is listed in the Driver Version field.
Select the Start button, then type settings. Select Settings > Network & internet. The status of your network connection will appear at the top.
I ended up following a link to MSDN when I was reading this page where I found the GetBestInterface function. I was able to use that to find the adapter thats connected to the internet
Examine the routing table and look for the interfaces that have a default route (a route to 0.0.0.0
) - that's your interface(s) that are connected to the wider world (if any).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With