DataSocket Read Function

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.


icon

Inputs/Outputs

  • cstr.png connection in

    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.

  • cfxdt.png type (Variant)

    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.

  • ci32.png ms timeout (10000)

    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).

  • cerrcodeclst.png error in (no error)

    error in describes error conditions that occur before this node runs. This input provides standard error in functionality.

  • cbool.png wait for updated value (T)

    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.

  • iu32.png status

    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.

  • iu64.png quality

    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 Number Description
    1 The value from this shared variable might not be the most current value from the data source.
    2 Sensor failure.
    3 General device error response.
    4 Server failure.
    5 General communications failure.
    6 Unable to locate variable in the Shared Variable Engine. Deployment of this variable may have failed.
    7 The shared variable has no known value.
    8 The shared variable is inactive.
    10 Low Limited.
    11 High Limited.
    12 Constant.
    13 Sensor inaccurate.
    14 Engineering unit limits exceeded.
    15 Generic OPC Error.
    16 Math error.
    17 Communications link failure.
    18 NI-PSP has not connected to the server yet.
    19 DNS lookup failed for the server.
    20 The server is not reachable.
    21 Service lookup failed for the server.
    22 The connection to the server was disconnected.
    23 The process was not found or is not responding.
    24 Failed to resolve URL for this shared variable.
    25 Read access is denied to the shared variable.
    26 Invalid URL for this shared variable.
    30 Point has an active alarm.
    31 Subscription failed.
    32 Quality bit greater than 32 is set, or there is an error/status reported.
    33 The shared variable client-side read buffer is full.
    34 The shared variable client-side read buffer overflowed.
    35 The shared variable server-side write buffer is full.
    36 The shared variable server-side write buffer has overflowed.
  • istr.png connection out

    connection out is the data source that specifies the data connection.

  • ifxdt.png data

    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.

  • ibool.png timed out

    timed out returns TRUE if the function timed out waiting for an update or an initial value.

  • ierrcodeclst.png error out

    error out contains error information. This output provides standard error out functionality.

  • iatrn.png timestamp

    timestamp returns the timestamp data for shared variables and NI Publish-Subscribe Protocol (NI-PSP) data items.

  • Examples

    Refer to the following example files included with LabVIEW.

    • labview\examples\Data Communication\DataSocket\Simple DataSocket\Simple DataSocket.lvproj