readTimeout Property |
Top Previous Next |
Gets or sets the maximum time to wait for receive data. SyntaxCell.Serial[n].readTimeout Property ValueThe maximum time, in milliseconds, for the read function to wait for receive data. RemarksThe default value for this property is zero, meaning the read function will return immediately with only data that was already in the receive buffer. The maximum value is around 60,000, or one minute, except that the property may also be set to the value Infinity (or +Infinity). In the latter case the read function will block execution indefinitely until the requested number of bytes is received. Examples// Wait up to 2 seconds until a 4-byte message received // Much simpler than example for bytesCanRead
val = Cell.Serial[0].read(4); if (val.length < 4) ; // timeout
// Disable timeout Cell.Serial[1].readTimeout = Infinity; val = Cell.Serial[1].read(1); See Also |