06-02-2011 03:06 PM
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
06-02-2011 03:24 PM - edited 06-02-2011 03:27 PM
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
06-02-2011 03:41 PM
But as I do this in LabVIEW or from where I can specify this.
Thanks Mark
06-02-2011 03:43 PM
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.
12-09-2011 02:21 AM
While "Bind" one can specify the local IP address.
12-09-2011 07:23 AM - edited 12-09-2011 07:24 AM
@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.
12-09-2011 10:05 PM
@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.
12-10-2011 03:36 AM
@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.
12-09-2014 10:05 PM
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.