Using Multiple Network Cards with LabVIEW

Updated Aug 1, 2023

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base

Issue Details

Will LabVIEW support two network cards?

Solution

There are several ways to achieve this:
1. Distinguish different Network Interface Cards (NICs) through TCP is by using the TCP Listen.vi and TCP Create Listener.vi. Both VIs have an input parameter called net address.  Use the String to IP function for the input in order to enter the IP address of the network card you wish to use.
  • Once this connection is established, you may use the Connection ID or Listener ID output to reference this connection. This functionality was specifically implemented for multiple network card configurations. 
 

Figure 1. Using TCP Listen.vi
 

Figure 2. Using TCP Create Listener.vi
 
2. If using TCP Open Connection, the operating system decides which network card to use based on the local PC's IP address and the IP address of the computer to which you are attempting to open a connection.

3. By using FTP VIs, there are actually two connections being made with the FTP server.
  • First connection is the command connection, where commands are being sent. The FTP server is the listener and the client is the one that opens the connection.
  • Second is a data connection, which is opened only when transferring a file. For the data connection there are two choices : Active or Passive.
    • Active connection: the data connection is opened by the FTP server and the client is the listener (reverse of the command connection)
    • Passive connection: FTP server listens and the client connects.
**Active is the default behavior for most FTP clients which means that we are doing a TCP Listen on the client side.

The simplest way to make LabVIEW use a particular network card is to simply force the connection to be Passive by changing the Active input of FTP Get File.vi to false and entering the IP address of the network card to the host input of the FTP Get File.vi. 

Figure 3. Using FTP Get File.vi


 

Additional Information

Prior to LabVIEW 6.1
Before LabVIEW 7, there was no way to specify which network card LabVIEW would use to listen for connections. LabVIEW would simply open a WinSocket connection, and Windows would decide which network card should be used. Most likely, the card designated as the primary network card would be selected.

Note: To use snippets, please save the image and drag the image into LabVIEW