Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

DataSocket Read

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

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.

Examples

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 VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
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 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. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.
timestamp returns the timestamp data for shared variables and NI-PSP data items.

Examples

Refer to the following VIs for examples of using the DataSocket Read function:

  • DS Reader With Attributes VI: labview\examples\comm\datasktx.llb
  • DS Reader VI: labview\examples\comm\datasktx.llb
  • DS 3D Graph Reader VI: labview\examples\comm\datasktxwin.llb

Resources


 

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