Programmatically Opening and Closing Data Connections

LabVIEW 2018 Help

Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)

LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

Use the DataSocket Open and DataSocket Close functions to open and close data connections programmatically.

Complete the following steps to open and close a data connection programmatically.

  1. Add the DataSocket Open function to the block diagram.

  2. Wire a psp URL to the URL input or wire a shared variable control to the URL input.
  3. Right-click the mode input and select Create»Constant from the shortcut menu.
  4. Click the mode constant and select Read (0), Write (1), ReadWrite (2), BufferedRead (3), or BufferedReadWrite (4). You also can use the DataSocket:Mode property to set the data connection mode programmatically.
  5. Add one of the following functions to the block diagram and create controls or constants for the appropriate inputs:
  6. Wire the connection id output of the DataSocket Open function to the connection in input of the DataSocket Read or DataSocket Write function.
  7. Add a DataSocket Close function to the block diagram.

  8. Wire the connection out output of the DataSocket Read or DataSocket Write function to the connection id input of the DataSocket Close function to close the data connection. The connection also closes when the VI stops.
  9. Wire all error in and error out terminals on the block diagram.


Not Helpful