title: Sockets and multiple IP Addresses
body: <p>I have two internet cards on my machine configured with two separate ip addresses. Both ip addresses are part of the same network. Am I right in saying that when I create a socket that it is specific for one of these ip addresses? </p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Here's my situation:</p>
  
  <p>I have a hardware device located at 192.168.0.10. It communicates via udp to (192.168.0.11, 50000) and (192.168.0.12, 50000). The hardware device does this via two ports, as follows: (192.168.0.10, 49000) and (192.168.0.10, 49001).</p>
  
  <p>I create the ports (192.168.0.11, 50000) and (192.168.0.12, 50000) via a script so that I can log and manipulate the communication, the data is then forwarded to two simulators which are capable of talking with the hardware.</p>
  
  <p>So in effect, my script is "the man in the middle" where I log and corrupt data for the purpose of testing the hardware.</p>
  
  <p>Here are the socket interfaces for my script:</p>
  
  <pre><code>IP 1 - Channel 1
  
  External_socket = (192.168.0.10, 49000) ** Hardware
  External_side_socket = (192.168.0.11, 50000) ** Script
  Simulator_side_socket = (192.168.0.11, 50001) ** Script
  Simulator_socket = (192.168.0.11, 50002) ** Simulator
  
  IP2 - Channel 2
  
  External_socket = (192.168.0.10, 49001) ** Hardware
  External_side_socket = (192.168.0.12, 50000) ** Script
  Simulator_side_socket = (192.168.0.12, 50001) ** Script
  Simulator_socket = (192.168.0.12, 60002) ** Simulator
  </code></pre>
  
  <p>And this works as expected, and the correct data is logged for each channel. </p>
  
  <p>However, it stops working if I make two simple changes: </p>
  
  <p>1) I change the second simulator's configuration file to 50002 from 60002, while keeping the ip address at 192.168.0.12.</p>
  
  <p>2) In my script I also change 60002 to 50002, for IP2.</p>
  
  <p>Suddenly the data from the second channel is arriving at the first simulator. How can this be? .net has an <strong>IPAny</strong> and I'm wondering if the simulator is using this somehow and ignoring the ip address in its config file. Do you think that might be the issue here?</p>
  
  <p>Thanks,</p>
  
  <p>Barry</p>