|LabWindows/CVI 2010 Help|
|LabWindows/CVI 2012 Help|
|LabWindows/CVI 2013 Help|
|LabWindows/CVI 2015 Help|
|LabWindows/CVI 2017 Help|
|LabWindows/CVI 2019 Help||LabWindows/CVI 2020 Help|
A network variable is a variable that you can use to share data between applications running on the same or different computers. Network variables use the NI Publish-Subscribe Protocol (NI-PSP) data transfer protocol to write and allow users to read live data. NI-PSP is a proprietary technology that provides fast and reliable data transmission for large and small applications.
Reference a network variable using its pathname. The pathname is similar to network file share names, such as \\machine\myprocess\item on Windows. In this example, machine is the computer name, IP address, or Fully Qualified Domain name of the server machine that is hosting the variable; myprocess contains network variable folders or variables and is referred to as a network variable process; and item is the name of the network variable. Following are additional examples:
You must open TCP ports in addition to UDP ports to configure firewalls and Network Address Translating (NAT) routers to transmit network variables. Starting at TCP port 59110, open one TCP port for each application you run. By default, NI-PSP begins looking for available TCP ports at port 59110 and increments upward until it finds an available port for each running application. You manually can configure the range of TCP ports that NI-PSP uses by creating and editing a logosxt.ini file. For RT targets, you can configure the range of TCP ports in the ni-rt.ini configuration file.
You can create network variables either explicitly or implicitly.
You can create and configure network variables explicitly with the stand-alone NI Distributed System Manager or programmatically using Network Variable Library functions.
Select Start»All Programs»National Instruments»Distributed System Manager to access this application, which is included in the LabWindows/CVI installation. Use this application to create new processes and variables, delete existing processes and variables, start and stop processes, create variables with specific data types or the variant data type, allow multiple writers or restrict write access to a single client, configure server buffering, and so on. For more information, refer to the NI Distributed System Manager Help, which you can access from the Distributed System Manager.
Use the Configuration Functions in the Network Variable Library to programmatically create and configure network variables explicitly. You can create a single variable with the CNVNewVariable function or create a number of variables with the CNVNewVariableCollection function. You also can create, delete, start, and stop network variable processes using the Process Functions. Use the Folder Functions to create and delete folders programmatically. Explicit variables that you create programmatically do not have a concrete data type by default and can hold values of any type. If you want to specify the data type for a network variable, call the CNVSetVariableAttribute function and set the CNVVariablePrototypeAttribute attribute. Explicit variables continue to exist after the program terminates.
Although you can programmatically configure network variables, you must use the Distributed System Manager to configure security settings.
|Note When you create variables programmatically, you specify server buffer capacity as number of items. If you use the Distributed System Manager, you must specify server buffer capacity in bytes for certain data types. If you create a network variable programmatically and then want to configure the variable using the Distributed System Manager, the Distributed System Manager may change the buffer size to bytes.|
You can implicitly create network variables in the system process: a new variable is created automatically when you connect to it, if the process name is system and the variable name you specify does not already exist in the system process. For example, \\localhost\system\test would implicitly create a variable called test in the system process on your local computer. If the variable already exists, then your program connects to the existing variable and does not create a new variable. An implicitly created variable is automatically deleted by the server when all of its clients have disconnected. Implicit variables have no concrete data type and can hold values of any type. They always have the single-writer restriction and their values are not buffered on the server, but their values can be buffered on the client. Implicit variables are easier to deploy because they are automatically created and deleted.