Select network interface

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I would to know if there's a way to use a particular network interfaces to
access network(programmatically c#). The problem is that if my wireless
network card is working, I want my application to use this one to access the
network.

Thanks
 
Marc,

If you are using Sockets, then you can bind to a particular IP address
(you have to figure out on your own which network adapater has which
address). However, if you don't, then it's up to the discretion of the API
provider to provide this functionality (which most don't).

You ^could^ disable the other network card, so that the winsock layer
has no choice but to go through the network adapter that you specify, but
this can have adverse effects on other programs, and is not the best of
solutions.

Hope this helps.
 
hi,

This is a rather difficult thing to do, to your app there is no
difference between the "wired" and "wireless" interface, you would have to
query the interface and see which ( if any ) is wireless.

I think you could do something like that using WMI , but not sure about it.

Cheers,
 
Back
Top