DataUpdated Property (Read Only)

NI DataSocket

DataUpdated Property (Read Only)

Syntax

CWDataSocket.DataUpdated

Data Type

Boolean

Purpose

Indicates if values or attributes on the CWDataSocket have been set since they were last read.

Remarks

This property is automatically set to True when the value or attributes of the CWDataSocket data have been set and automatically reset to False after this property is queried. The OnDataUpdated event is generated when DataUpdated changes from False to True.

The DataUpdated property is most useful when using the Read mode.

This property is best used in the following way:

When the Reader application wants to get new data from the server, it calls the Update method. The Update method is asynchronous. The method returns before the new data is actually retrieved from the server. The Reader program should not read the data until the DataUpdated property has changed state. The OnDataUpdated event also is generated, and the event procedure returns the data. Use the DataUpdated property only when you do not want to write an event procedure.

If you are in ReadAutoUpdate mode, the OnDataUpdated event serves as the notification that new data is available. The DataUpdated property changes the value from True to False when the event is generated because the event returns the data. Because the event is generated more quickly than you can poll the value of the property, it is difficult to ever see the DataUpdated property set to True.

Example

'Get the value only if it has been updated.
If CWDataSocket1.DataUpdated Then
    v = CWDataSocket1.Data.Value
    'DataUpdated is now False.
End If

See Also

OnDataUpdated