Receive Data
The Receive Data Block is used to receive byte array or string data, via TCP/IP or serial protocols. Using multiple buffers for each device, pins are set according to the buffer, when the Block runs, and then flushes the latest buffer. The Block can also be configured to consume all of the available data, and to hold the Task until all of the data has arrived.
During execution of the Task, when data is received via the specified device, the received data is pushed into a buffer. A separate buffer collection is used for each device, so if data is received while the device already has data in its buffer, the new data will be pushed into the next buffer.
When the block is executed, any data in the oldest buffer is formatted according to the specified Data Type and Encoding parameters, and then associated to the output pin. At this point, the oldest buffer is removed.
- If the Consume Mode is set to All Buffers, all of the buffers will be consumed when the block is executed, versus the oldest buffer when set to One Buffer.
- If the deployed mode is set to Don't Wait, the block will return data immediately available, even if no new data has been received.
- If the deployed mode is set to Wait until Data received, the block will wait to return data until there is new data available, or the timeout expires.
| Setting | Description |
|---|---|
| Selected Device | Sets the device associated with the block, either a TCP/IP or RS232 device. |
| Data Type | Sets the data type, byte array or string. By default, string is set. |
| Encoding | Sets the type of encoding to use. By default, Unicode (UTF-8) is set. This setting is ignored if the Data Type is set to byte. |
| Deployed Mode | Specifies how the block will handle data. By default, the block is set to Don't wait, which specifies that the block will return the data in the buffer, even if new data is available. When set to Wait until Data is received, the block will wait until new data is available, or the Timeout expires. |
| Timeout (ms) | Specifies a timeout if the deployed mode is set to Wait until Data received. |
| Consume Mode | Specifies how the block will handle the data buffers. By default, the block is set to One Buffer, which specifies that the block will only consume the oldest buffer at execution. |