Buffering

NI DataSocket Server

Buffering

Buffering is a DataSocket Transfer Protocol (DSTP) feature that minimizes the likelihood that a DataSocket Server will drop data values. With buffering, the DataSocket Server temporarily stores the values published to a data item in a first-in, first-out (FIFO) buffer for the data item before sending the data to subscribing clients. Provided that a buffer never exceeds its capacity, buffering prevents unprocessed values from being overwritten and dropped by the DataSocket Server.

You can configure individual buffering constraints for each predefined data item on a DataSocket Server or you can configure default buffering constraints for all dynamically created data items.

Note  Some application development environments such as LabVIEW maintain client-side buffers in addition to the server-side buffer. To minimize data loss, set the buffering constraints for both the DataSocket Server and the subscribing DataSocket clients. Refer to the LabVIEW Help for information about client-side buffering in LabVIEW.

Sometimes the DataSocket Server will have to drop values to enforce the buffering constraints for a data item. When the DataSocket Server needs to drop a value, it drops values from the front of a buffer—that is, it drops older data in favor of newer data. More specifically, the DataSocket Server drops a value from the front of a buffer when one of the following conditions is true:

  • All clients currently subscribed to the data item have received the value, or
  • Inserting a new value into the back of the buffer violates either of the two buffering constraints that you set for that data item.

The DataSocket Server does not notify DataSocket Readers or Writers when it drops data values. DataSocket Writers can add a sequence number attribute to the published data, so DataSocket Readers can detect dropped values in a data stream by checking the sequence number attribute.