Deploying Shared Variables to a Specific Network Card

Updated Jan 19, 2023

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base

Issue Details

I am deploying my shared variable on the host PC and trying to write to the variables from my real-time target. Why am I not seeing the values update?

Solution

As of LabVIEW 2012 Logos Sockets automatically broadcasts Shared Variables to all available NICs. The process described below is not valid for version 2012 or later.

Normally, the Shared Variable Engine uses the default network adapter for the system on which it is running. In the case of a system having both wired and wireless connections, the wireless connection is generally the default connection. In LabVIEW 8.2.1, the ability to specify which network adapter will be used by the Shared Variable Engine was added. This is done by modifying the appropriate .iniconfiguration file depending on whether the shared variables are being hosted on a Windows-based system or an RT-based system.

For a Windows-based system: 
If one does not already exist, create a file in the C:\WINDOWS directory named logos.ini and add the following lines to the file:

[LOGOS]
ServiceBindTo=XX:XX:XX:XX:XX:XX
 


where XX:XX:XX:XX:XX:XX is the MAC address of the Ethernet card to want to bind to. The MAC address can be found by running ipconfig /all from a command prompt. This will be the Physical Address as listed by the ipconfig command.

In order for the Shared Variable Engine to bind to this ethernet card, the computer will need to be restarted.

The IP address also needs to be changed to reflect the IP address of the desired network card under the My Computer settings in the LabVIEW Project Explorer.

Right-click on My Computer within the LabVIEW Project Explorer, click on Properties. Under the General tab, click the Specify Custom Address checkbox, and enter the IP address of the network card that the shared variables will be deployed to.

For an RT-based system
To bind shared variable communication to a specific adapter on an RT-based system, add the following lines to the ni-rt.ini file located in the highest level directory on the target:

[LOGOS]
ServiceBindTo=primary
 

to bind to the primary adapter, or: 

[LOGOS]
ServiceBindTo=secondary
 

to bind to the secondary adapter.

Other Causes of Communication Trouble

If your RT target is receiving Error -1950679022 from the shared variable error out terminal, then the problem is likely writing to the wrong adapter (see above), or a firewall issue. The Windows Vista Firewall may prevent writing to shared variables hosted by the Vista machine. The firewall can be turned off to allow for RT targets to write to the shared variables published on the Vista host. 

Note: As of LabVIEW 8.2.1, you can define what network card will be used for deploying shared variables. In the previous versions of LabVIEW, the Shared Variable engine used the default Ethernet device which can be changed in the Windows OS.

Note: If you are using DAQmx devices in the same LabVIEW project that you change the IP address in, make sure that the 2nd NIC card is always on. If the router is unplugged or the NIC card is disabled this will cause you not to see your DAQmx devices in the related LabVIEW project.
 

Additional Information

If you are using LabVIEW 2015 SP1 or later on Windows 10 OS, you can change the priority order of network adapters. On Windows 10, if you have a device with more than one network adapter (such as two network card), each interface receives a priority value automatically based on its network metric, which defines the primary connection that your device will use to send and receive, so the Variable Engine deploy the variable basing on this order.
You can configure the order of the network adapters manually through Control Panel or PowerShell.

For Control Panel:
  1. Open Settings.
  2. Click on Network & Internet.
  3. Click on Status.
  4. Click the Change Adapter options item.
  5. Right-click the network adapter you want to prioritize, and select Properties.
  6. Select the Internet Protocol Version 4 (TCP/IPv4) item.
  7. Click the Properties button.
  8. In the "General" tab, click the Advanced button.
  9. Clear the Automatic metric option.
  10. In the "Interface metric" field assign a priority value for the adapter.

 
The lower the metric number means higher priority, and a higher number indicates lower priority. NI Varible Engine choses the network card with the lower metric number for deploying the shared variables.