02-27-2017 06:28 PM
Hello.
I want to get a socket connection to a device, but I have several Ethernet interfaces on my computer so I want to open a TCP connection by using an specific IP from my PC. Is there any way to do this?
Regards!
Solved! Go to Solution.
02-28-2017 02:07 AM
In order for multiple network interfaces to work properly in a single system, each network interface must belong to a specific/distinct subnet. If that is the case, the OS will already take care of selecting the correct interface.
Example:
One interface runs 192.168.1.100 as IP address, the other runs 10.0.1.100. These are two different, private IP addresses belonging to two different subnets (192.168.0 and 10.0.1). If your code tries to connect to e.g. 10.0.1.111, the OS will automatically pick the second device.
02-28-2017 08:50 AM
Hi Norbert.
Thanks for your response.
In my case, I have 7 network interfaces but they are in the same subnet range, since I am testing several ports of the same device.
02-28-2017 08:55 AM - edited 02-28-2017 09:01 AM
Do these ports have to be tested in parallel? If not, i would go for a single network device and test the UUT ports one after another.
Besides: How does your device support 7 ports in parallel all connect to the same subnet (if you have to test parallel)?
EDIT: Please review this KB from Microsoft. I think it fits well in this topic and shows you the source of the issue.
02-28-2017 09:34 AM
My product has a kind of an Ethernet switch, I test its ports one by one with a ping, and use one of them as my principal communication link, but since it is a continuous test, I have dedicated ports.
Based on the information you provided me, I found a way to get connected to the device by re-trying the TCP connection, so at each attempt the SO uses a different network device, and it continues once the link is established.
Thanks for your support.
David