LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't open TCP connection when two network adapter are enabled

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

0 Kudos
Message 1 of 8
(4,599 Views)

Hi!

 

When you are on the server side and waiting for a connection you can specify the network address to use:

 

http://zone.ni.com/reference/en-XX/help/371361D-01/lvcomm/tcp_listen/ (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

0 Kudos
Message 2 of 8
(4,593 Views)

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

0 Kudos
Message 3 of 8
(4,581 Views)

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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 8
(4,576 Views)

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

 

0 Kudos
Message 5 of 8
(4,573 Views)

Hi


Have you try the ADD ROUTE command which Mark Yedinak has explained?

0 Kudos
Message 6 of 8
(4,539 Views)

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

0 Kudos
Message 7 of 8
(4,532 Views)

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/

0 Kudos
Message 8 of 8
(4,520 Views)