Read live data from a DataSocket connection to manipulate the data before you display it on the front panel or pass the data to a VI or function on the block diagram.
Complete the following steps to read live data programmatically through a DataSocket connection.
Note You must install the DataSocket Server to read live data programmatically.
Open the DataSocket Server by selecting Start»Programs»National Instruments»DataSocket»DataSocket Server.
Select the DataSocket Read function on the Functions»Communication»DataSocket palette and place it on the block diagram.
Specify a URL in the URL input of the DataSocket Read function. You can use the file protocol to read a URL from a DataSocket Link (DSL) file instead of storing the URL in the VI that reads the data from the server. For example, if the DataSocket Server is unavailable and you want to move the server to another location, you can change the URL in the DSL file instead of changing the URL in every VI that reads data from the server. Even though you moved the server, the reading process is transparent to users. The readers connect to the DSL file and the file redirects the reader to the URL contained in the file.
Complete the following steps to create a DSL file that contains the URL of the DataSocket Server with a named tag for the data appended.
Use any text editor to create and open a new text document.
Type the following in the text document, where servername.com is the URL to the server and tag is the named tag for the data:
[InternetShortcut]
URL=dstp://servername.com/tag
Save and close the file.
Change the file extension from .txt to .dsl.
Wire a control or constant to the type input of the DataSocket Read function. The data type of the control or constant must match the data type of the data you expect to read. The default data type is the variant data type. If you are unsure of the data type of the data you expect to read or if another application is generating the data, use the variant data type. You can convert variant data to data that LabVIEW can manipulate. If you use the file protocol in the URL input to read a URL from a DSL file, you must wire the data type of the data you expect to read to the type input.
Run the VI or continually run the VI for live data updates.