Communication Between Labview Executable in Run-Time Environment and VI in Development Environment

Updated Dec 16, 2020

Reported In


  • 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. I am experiencing one of the following problems when running my program:
  • ​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?
  • When I try to access the run-time environment remotely, the Open Application Reference VI throws Error 66: The network connection was closed by the peer. How can I resolve this error and retrieve a valid application reference to my remote executable?


If you are trying to communicate between an executable and VI running on the same machine, the most common problem that you will run into 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. This is the first thing you should confirm when troubleshooting environments running on the same machine.

The rest of this article applies to executables running both on the same machine as the development environment and those running on a remote machine:
  • 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. You will need to enable TCP/IP access for your project and allow network connections from the development computer by adding its IP address to the whitelist in the same menu. 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 running on the same machine as this VI at the port specified in the VI's properties. To modify this code for remote access, substitute the deployment computer's IP address for 'localhost' as input to the Open Application Reference VI. 

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 on the same machine 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.

To communicate with a LabVIEW development environment running on a different machine, allow TCP/IP access for the remote machine's IP address on the development machine, instead of 'localhost'. The default port can be used by both environments since they are running on different machines.

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.

General Troubleshooting Tips
  • A common source of difficulty when running on the same machine 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.
  • There are multiple places in LabVIEW where TCP/IP access settings can be modified. Accessing these properties from the LabVIEW toolbar will edit the properties for the development environment, while accessing these properties from My Computer in the project explorer window will edit the properties specifically for that project (and ultimately a build from the project). Make sure you are changing the appropriate settings for your application. For example, a built executable will not inherit TCP/IP access properties from the LabVIEW development environment and this can be a source of confusion. Set the properties for the project locally instead.