Read Variable with Timeout
- Updated2025-07-30
- 4 minute(s) read
Reads a new value from a network-published shared variable. Instead of returning the latest data value, which might have been read already, this function performs a blocking read, which means the function does not finish executing until a new value arrives or the timeout you specify expires.
Use this function to avoid reading data values that you already have read. If you need to read the current value regardless of whether the value changes, use the Read Variable function.

Inputs/Outputs
shared variable refnum in
—
data type
—
data type specifies the data type of the shared variable or I/O variable container. For I/O variable containers, you must specify an array data type. This input is available only if the data type has not been previously specified. You can specify a data type by placing a checkmark in the Specify Data Type checkbox on the Configuration page of the Properties dialog box for the variable refnum. If you specify the data type upon opening the connection, this terminal is unavailable on subsequent read and write functions.
timeout ms
—
timeout ms specifies the time, in milliseconds, that the function waits before timing out. A value of –1 specifies no timeout. The default is 0. Use the timed out? output to detect a timeout.
error in (no error)
—
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
shared variable refnum out
—
data out
—
data out is the data read from the shared variable or I/O variable container.
timed out?
—
timed out? is TRUE if a new element does not become available within the timeout you specify. If the timeout expires, this function returns the last value written to the variable and does not return an error.
error out
—
error out contains error information. This output provides standard error out functionality.
timestamp
—
timestamp is the timestamp indicating when the current data was written to the shared variable. This output is available only if you place a checkmark in the Read Timestamp checkbox on the Configuration page of the Properties dialog box for the variable refnum. I/O variable containers do not support timestamps. |
Each variable connection treats a value as new only once. If multiple Read Variable with Timeout functions share the same variable connection, each instance of the function returns a different value depending on the order in which the instances execute.
shared variable refnum in
—
data type
—
timeout ms
—
error in (no error)
—
shared variable refnum out
—
data out
—
timed out?
—
error out
—
timestamp
—