How to determine which network adapter is connected to the internet

后端 未结 6 955
死守一世寂寞
死守一世寂寞 2020-12-20 20:23

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 ca

6条回答
  •  悲&欢浪女
    2020-12-20 20:39

    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).

提交回复
热议问题