title: How to select ethernet or wifi to send TCP?
body: <p>Here is my problem: My computer is connected to internet with ethernet cable, and also connected to a wifi module. But when I want to send TCP to my module, it always choose ethernet by default. </p>
  
  <p>I have to disconnect my cable to send TCP to my module, but I will need the two connections and know how to swap between them.</p>
  
  <p>How can I choose the interface i want in c#?
  Can I swap between them in a single program?
  I already use System.Net and the Managed Wifi API.</p>
  
  <p>Thank you for your answers.</p>
  
  <p>Edit:</p>
  
  <p>As @Someprogrammerdude and @sam suggest, i use socket.bind() with the IP address of the default gateway of my wifi to send TCP on it. But when I try to bind, there <code>the requested address is not valid in this context</code> error. So I checked the default gateway address (sry french) :
  <a href="https://i.stack.imgur.com/mEZza.png" rel="nofollow noreferrer">ipconfig</a></p>
  
  <p>We can see that my wifi default gateway is 192.168.1.2 and ethernet 192.168.1.1. I tried to put them "manually" but i have the same result.. It cannot be the port i checked myself on the module that he is well opened</p>
  
  <p>Edit 2:
  Nvm, i had to bind 192.168.1.100, and not 192.168.1.2. Thank you for your answers, you helped me a lot.</p>