DataSocket Read Function

Owning Palette: DataSocket VI and Functions

Requires: Base Development System

Dequeues the next available data value from the client-side buffer associated with the connection you specify in connection in and returns the data.

Note  Client-side buffering also applies to other protocols, such as opc and file. However, in some cases these servers might lose data.

Example

 Add to the block diagram  Find on the palette
connection in identifies the data source to read. connection in can be a string that describes the URL, a shared variable control, a connection id reference parameter output from a DataSocket Open function, or a connection out parameter output from a DataSocket Write function.
type (Variant) specifies the type of data you want to read and defines the type of the data output terminal. The default type is Variant, which can be any type. Wire any data type to this input to define the output data type. LabVIEW ignores the value of the input data.
ms timeout specifies how long to wait for a value update to become available in the connection buffer. The function ignores this input and does not wait if wait for updated value is FALSE and an initial value arrived. The default is 10,000 ms (10 seconds).
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
wait for updated value causes the function to wait for an updated value if set to TRUE. If the connection buffer contains unprocessed data, the function returns the next available value immediately. Otherwise, the function waits ms timeout milliseconds for an update. If an update does not occur in the timeout period, the function returns the current value and timed out is TRUE. If wait for updated value is FALSE, the function returns the next available value in the connection buffer or the last value read if no data is available.
status reports warnings or errors from a PSP server or FieldPoint controller. If the 31st bit is 1, status indicates an error. Otherwise, status indicates a status code.
quality is the data quality of the data read from a shared variable or an NI Publish-Subscribe Protocol (NI-PSP) data item. Use the value of quality for information for debugging a VI. The following table lists some of the possible quality values.

Bit NumberDescription
1The value from this shared variable might not be the most current value from the data source.
2Sensor failure.
3General device error response.
4Server failure.
5General communications failure.
6Unable to locate variable in the Shared Variable Engine. Deployment of this variable may have failed.
7The shared variable has no known value.
8The shared variable is inactive.
10Low Limited.
11High Limited.
12Constant.
13Sensor inaccurate.
14Engineering unit limits exceeded.
15Generic OPC Error.
16Math error.
17Communications link failure.
18NI-PSP has not connected to the server yet.
19DNS lookup failed for the server.
20The server is not reachable.
21Service lookup failed for the server.
22The connection to the server was disconnected.
23The process was not found or is not responding.
24Failed to resolve URL for this shared variable.
25Read access is denied to the shared variable.
26Invalid URL for this shared variable.
30Point has an active alarm.
31Subscription failed.
32Quality bit greater than 32 is set, or there is an error/status reported.
33The shared variable client-side read buffer is full.
34The shared variable client-side read buffer overflowed.
35The shared variable server-side write buffer is full.
36The shared variable server-side write buffer has overflowed.
connection out is the data source that specifies the data connection.
data is the result of the read. If this function times out, data returns the value that this function last read. If this function times out before reading any data or if the type of data is incompatible, data returns a value of 0, empty, or an equivalent value.
timed out returns TRUE if the function timed out waiting for an update or an initial value.
error out contains error information. This output provides standard error out functionality.
timestamp returns the timestamp data for shared variables and NI Publish-Subscribe Protocol (NI-PSP) data items.
Path to the VI.

Example

Refer to the Simple DataSocket.lvproj in the labview\examples\Data Communication\DataSocket\Simple DataSocket directory for an example of using the DataSocket Read function.

 Open example  Find related examples