LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicating through two ethernet ports on the same computer.

Hi Mark, I would like to know how we select the network you use each VI in LabVIEW, because I have in you computer with 2 network cards configured

0 Kudos
Message 11 of 19
(2,110 Views)

You would have to define a permanent route that would force all data for a specified IP address range to the specific network adapter that you want to use. For example let's say you have 2 NIC with the IP addresses of 10.3.1.10 on NIC 1 and 192.168.0.10 on NIC 2. To route all trafific destined for any address that starts with 198 you would add a route as follows:

 

route ADD 192.0.0.0 MASK 255.0.0.0  192.168.0.1 METRIC 3 IF 2



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 12 of 19
(2,103 Views)

But as I do this in LabVIEW or from where I can specify this.

Thanks Mark

0 Kudos
Message 13 of 19
(2,096 Views)

You would add the route at the command line. This wouild only need to be done once. In your LabVIEW code you would simply use the IP address of the device you want to communicate with. You may have issues if you use devices names that require DNS lookup since that is more difficult to control what DNS servers will be used to do the address resolution.



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 14 of 19
(2,093 Views)

While "Bind" one can specify the local IP address.

0 Kudos
Message 15 of 19
(2,034 Views)

@rajiv wrote:

While "Bind" one can specify the local IP address.



The BSD socket function bind() is an optional function. If not called the socket will be bound to the default network interface that handles the subnetwork address range for the desired remote address. If called and you happen to bind it to a network interface that is not configured to route the actual remote address, then no communication will happen. So in general, bind() on a client network connection is not only superflous but even can cause errors.

Rolf Kalbermatter
My Blog
0 Kudos
Message 16 of 19
(2,027 Views)

@rolfk wrote:

@rajiv wrote:

While "Bind" one can specify the local IP address.



The BSD socket function bind() is an optional function. If not called the socket will be bound to the default network interface that handles the subnetwork address range for the desired remote address. If called and you happen to bind it to a network interface that is not configured to route the actual remote address, then no communication will happen. So in general, bind() on a client network connection is not only superflous but even can cause errors.



That's what is said, if you don't specify you will be bind to default. I have one local IP as 192.168.100.X and one at 10.127.2.X it prefer to bind to 192 network. But if you call bind and explicitly tell which local IP to bind, it do it very well. I have been using it on my control network for years and is very reliabily.
You are right if it is bind to wrong network, no USEFUL communication will occure.
0 Kudos
Message 17 of 19
(2,015 Views)

@rajiv wrote:
That's what is said, if you don't specify you will be bind to default. I have one local IP as 192.168.100.X and one at 10.127.2.X it prefer to bind to 192 network. But if you call bind and explicitly tell which local IP to bind, it do it very well. I have been using it on my control network for years and is very reliabily.

It will only bind to 192... if it is the default network interface AND the desired remote address doesn't fall into the subnetrange configured for the 10... interface card. As such it's probabaly arguable but IMHO a configuration fault, if you want your default network traffic go to the 10.. interface and have configured the 192 card as default. This should really not be handled on application level but on system level instead by configuring the network stack correctly.

Rolf Kalbermatter
My Blog
0 Kudos
Message 18 of 19
(2,008 Views)

Hi Mr. Mark, do you have solution for your problem about communicating through two ethernet ports on the same computer? I think I have same problem with you. And I need that solution. thank you.

0 Kudos
Message 19 of 19
(1,727 Views)