How Can I Communicate Between the LabVIEW Run-Time Environment and the Development Environment on the Same Computer?

Updated Feb 5, 2018

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base
  • LabVIEW Professional

Issue Details

I would like to communicate between a LabVIEW executable (Run-Time Environment) and a vi (Development Environment) using VI server.

​When I use VI server to open an application reference to the LabVIEW Run-Time Environment (an executable VI) from a VI in the LabVIEW Development Environment (an editable VI), and vice versa. I have found that using "localhost" for the machine name, like the context help describes, doesn't work to communicate with the run-time environment.

When I try to communicate with the run-time environment, I find that the Open Application Reference VI will either open a reference back to the development environment, or it will return error -63. How can I open a reference to the run-time environment from the development environment on the same machine?
 

Solution

The main problem that you will run into when you have multiple LabVIEW environments loaded on the same machine is that each environment will usually attempt to use the default port of 3363 for its VI Server port. The first LabVIEW environment to load up under this port will usually maintain control of that port, which will cause other LabVIEW environments that attempt to access the port to fail. To avoid this, you must configure your other environments to use a different port number. 
  • Communicating from the LabVIEW Development Environment to an Executable VI (LabVIEW Run-Time Engine)  
Each Executable VI will launch its own instance of the LabVIEW Run-Time Environment, so in order to open an application reference of an executable VI from the development environment you must know the port number for that particular instance of the run-time engine. By default, the VI Server properties for an executable VI are setup to deny access from all TCP/IP requests, and to use port 3363. If you want to communicate with this VI from the development environment on the same machine, enable TCP/IP access for 'localhost' and use a different port number than the development environment (to avoid conflicts). 
To configure the VI Server settings for the executable, right click My Computer and select Properties, then navigate to VI Server and configure the TCP/IP access.



The following is an example of a VI that can be used to open up a reference to the run-time engine at port 3362. The Application.Kind property node can be used to verify that you have successfully opened a reference to the run-time environment. The example also shows how once you have opened an application reference to the run-time environment, you no-longer need a full path to open a VI reference to any VI that is currently loaded into memory in the run-time environment.  It is good practice to specify VIs only by name rather than the full path to ensure that LabVIEW always uses the copy of the VI loaded by the EXE.

  • Communicating to the LabVIEW Development Environment from an Executable
The easiest way to accomplish this is to place the development environment on a port that is different than the run-time engine and enable TCP/IP access for 'localhost'. If the executable is already setup to load into a unique port by setting the server.tcp.port setting in its .ini file, then the only change that will need to be made to LabVIEW is the TCP/IP settings. The TCP/IP settings can be changed under Tools»Options, clicking VI Server and then by modifying items in Configuration and TCP/IP Access. Make sure that the TCP/IP protocol is enabled and that 'localhost' is in the TCP/IP access list.
 
 
  • Troubleshooting
The main source of difficulty is when two different environments load into the same port. Simply changing the port number under Tools»Options usually isn't enough to fix this problem - you will probably need to exit out of both environments and make sure that they restart into a unique port.

Double-check the TCP/IP settings for all environments and make sure that the TCP/IP protocol is turned on and that 'localhost' is added to the access list.

Additional Information

From the block diagram of your VI, opening an application reference for the purpose of communicating between the development environment and the run-time environment on the same machine is going to be no different than opening any other type of LabVIEW application reference. We are going to use the Open Application Reference VI and we are going to give it an IP Address for the machine, and a port number that corresponds to the port number that is configured for the VI Server.

 

WAS THIS ARTICLE HELPFUL?

Not Helpful