06-21-2012 05:24 AM
Hi all,
I've an applicaiton that connect using "TCP Open Connection". The applicaiton is running on a computer have two network adapters configured to be on two different network.
When I start the application, if both network adapters are enabled, connection is not created (timeout). When I disable the network adapter which is not configured for the network I need, connection is succesfull.
- How can I choose which adapter to use to open the connection, as LabView seems enable to select the good one.
- Or I can I disable a network adapter (just for the connection time)
I'm using LabView 8.5 Full on Windows XP.
Thanks for your help
06-21-2012
05:41 AM
- last edited on
11-06-2024
06:36 PM
by
Content Cleaner
Hi!
When you are on the server side and waiting for a connection you can specify the network address to use:
https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/vi-lib/utility/tcp-llb/tcp-listen-vi.html (see parameter net address)
When opening the connection (as you do) I suppose the routing depends on the operating system and, of course, the destination address.
Can you ping your destination when both the cards are enabled?
Regards,
Marco
06-21-2012 07:47 AM
What do you mean by the adapters being on two different networks?
If you use something like 192.168.1.x on one and 192.168.2.x on another with a net mask of 255.255.0.0, the computer will treat these as one network and use the default network adapter when attempting to connect.
You must be very specific when creating your address and connecting. Use the IP address and not the computer name to connect to and ensure your network masks separate the two networks.
I have been using two network adapters for years with no problems connecting on separate networks.
Rob
06-21-2012 09:28 AM
This is generally a routing issue. The OS will route connections to your primary network if it is not a direct route. For example, one network is 10.3.4.x (primary network) and the other is 192.168.1.x.with a subnet of 255.255.255.0. Now, let's say you want to reach a device with an 192.168.2.x address. The OS will try to route this through the primary network but is has no route to reach the 192.168.2.x subnet. Therefore your connection fails. You can add a permanent route to your computer to force specific address ranges to specific NICs. Use the ROUTE ADD command which is part of the OS. If you are trying to reach the computer using a name instead of the IP address the issue is basically the same but a but more challenging to resolve. The OS will do th elookup on your defined DNS servers. They generally do not have knowledge of local private networks and therefore can't resolve the name. In this case you need to create a more involved network infrastructure to update the name server. Probably not something that is feasible to do.
06-21-2012 09:45 AM
Hi,
First thanks to all for your contribution.
Here are more details based on your reactions:
MarcoMauri - Yes, I can ping destination PC but can't open the connection.
Robert:
The PC i'd like to connect to has following IP: 10.0.0.2
Here are my network adapters settings:
Configuration IP de Windows
Carte Ethernet Connexion au réseau local:
Suffixe DNS propre à la connexion : xxxx.com
Adresse IP. . . . . . . . . . . . : 192.168.1.65
Masque de sous-réseau . . . . . . : 255.255.255.0
Passerelle par défaut . . . . . . : 192.168.1.1
Carte Ethernet D-link:
Suffixe DNS propre à la connexion :
Adresse IP. . . . . . . . . . . . : 10.0.0.100
Masque de sous-réseau . . . . . . : 255.0.0.0
Passerelle par défaut . . . . . . :
I use "Open TCP Connection" and give it the IP (10.0.0.2).
Is they something to change?
Thanks
Rodrigue
06-27-2012 04:23 AM
Hi
Have you try the ADD ROUTE command which Mark Yedinak has explained?
06-27-2012 06:52 AM
Hi,
I've tried without success the "Add route" command. I must tell that I need to better understand routing, as I may have not use it correctly.
In the meantime, I've found another solution. On windows XP, in network connection panel, in Advanced parameters menu, you can set the connections order. By setting the connection 10.0.0.100 as the top level connection, my application now connects correcly. However, doing the same setting in Windows 7 doesn't work (don't ask me why:)!!
So I'll need to spend more time understanding routing as it looks to be the good way to do it.
Rodrigue
06-27-2012 09:21 AM
Here you have a Tutorial how you can make a routing under Windows 7
http://www.howtogeek.com/howto/windows/adding-a-tcpip-route-to-the-windows-routing-table/