Determine the Correct URL for a DataSocket VI

Updated Dec 18, 2023

Reported In


  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Issue Details

I would like to open a DataSocket connection to a PSP, OPC, or DataSocket item, but I am not sure how to format the URL string for the DataSocket VIs.  How do I know the format of the string?


The easiest way to do this is with DataSocket Select  This VI can be found in the Functions Palette by right-clicking the block diagram and looking in the Data Communication»DataSocket palette.

Place DataSocket Select on the block diagram.  Right-click the URL output and Create»Indicator.  Click the Run button of the VI, and you will be prompted with a dialogue as shown below.
You can then expand the Server that you would like to connect to and choose the item you would like to open a DataSocket to.  Once you have selected the item, click OK.

Run the VI, and the URL will be generated and output to the indicator.  From the block diagram, you can right click the indicator and Change to Constant. Delete the DataSocket Select if you would no longer like the pop-up, and use the string constant in the rest of your program.  An example of a generated string constant is shown below.
The above string is broken into 4 sections.  The first section states the protocol, in this case opc.  Next, we have specified localhost as the IP address.  The third section is the Server Name, in this case it is National Instruments.NIOPCServers.V5.  Finally, the fourth section is the item name, which in this case is Channel1.Device1.Tag1.

The following table shows examples of each protocol URL: