Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Programmatically Opening and Closing Data Connections

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

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.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit