Identifying active network interface

后端 未结 5 1909
走了就别回头了
走了就别回头了 2020-12-01 02:30

In a .NET application, how can I identify which network interface is used to communicate to a given IP address?

I am running on workstations with multiple network in

5条回答
  •  执笔经年
    2020-12-01 02:44

    Neither of these will actually give the OP the info he's looking for -- he wants to know which interface will be used to reach a given destination. One way of doing what you want would be to shell out to the route command using System.Diagnostics.Process class, then screen-scrape the output. route PRINT (destination IP) will get you something useable. That's probably not the best solution, but it's the only one I can give you right now.

提交回复
热议问题