SerialDevice.ReadTimeout Property

Definition

Gets or sets the time-out value for a read operation.

public:
 property TimeSpan ReadTimeout { TimeSpan get(); void set(TimeSpan value); };
TimeSpan ReadTimeout();

void ReadTimeout(TimeSpan value);
public System.TimeSpan ReadTimeout { get; set; }
var timeSpan = serialDevice.readTimeout;
serialDevice.readTimeout = timeSpan;
Public Property ReadTimeout As TimeSpan

Property Value

The span of time before a time-out occurs when a read operation doesn't finish.

  • If ReadTimeout is 0, then there's no maximum interval between consecutive bytes in read operations. That is, read operations never time out.
  • If ReadTimeout is set to TimeSpan.FromMilliseconds(ulong.MaxValue) (see TimeSpan), then a read request completes immediately with the bytes that have already been received, even if no bytes have been received.
  • If ReadTimeout is less than TimeSpan.FromMilliseconds(ulong.MaxValue), and greater than 0, then a read operation times out only if the interval between a pair of consecutively received bytes exceeds ReadTimeout.

Note

The Windows Runtime APIs for serial devices thinly wrap the functionality of the corresponding Win32 APIs. So the meaning of the ReadIntervalTimeout member of the Win32 SERIAL_TIMEOUTS structure applies to SerialDevice.ReadTimeout. For specifics, see the SERIAL_TIMEOUTS structure, and Setting read and write timeouts for a serial device.

Applies to

See also