Serial Port Monitor - Software Serial Port sniffer, logger & protocol analyzer for Windows
Docs

ISerialTimeouts Interface

This interface is used to set session's timeout values.

A read or write request successfully completes when either the specified number of bytes is transferred or the requested read or write operation times out. The request returns the STATUS_SUCCESS status code to indicate that the specified number of bytes was transferred. The request returns the STATUS_TIMEOUT status code to indicate that the operation timed out.

For a read operation that is Ntotal bytes in length, the maximum amount of time, Tmax, that the serial port allows for the operation to complete is calculated as follows:

Tmax = Ntotal * readTotalTimeoutMultiplier + readTotalTimeoutConstant

A read request that exceeds this maximum completes when the time-out occurs, and throws a timeout exception.

For a write operation that is Ntotal bytes in length, the maximum amount of time, Tmax, that the serial port allows for the operation to complete is calculated as follows:

Tmax = Ntotal * writeTotalTimeoutMultiplier + writeTotalTimeoutConstant

A write request that exceeds this maximum completes when the time-out occurs, and throws a timeout exception.

The maximum time, Tmax, that is allowed for a read or write operation to complete is always measured from when the serial port starts the requested operation, and not from when the client submits the request.

If readIntervalTimeout, readTotalTimeoutMultiplier, and readTotalTimeoutConstant are all zero, read operations never time out. If writeTotalTimeoutMultiplier and writeTotalTimeoutConstant are both zero, write operations never time out.

If readIntervalTimeout is zero, there is no maximum interval between consecutive bytes in read operations, and time-outs are based solely on the readTotalTimeoutMultiplier and readTotalTimeoutConstant members.

If both readTotalTimeoutMultiplier and readTotalTimeoutConstant are zero, and readIntervalTimeout is less than 0xFFFFFFFF and greater than zero, a read operation times out only if the interval between a pair of consecutively received bytes exceeds readIntervalTimeout. If these three time-out values are used, and the serial port's input buffer is empty when a read request is sent to the port, this request never times out until after the port receives at least one byte of new data.

If readIntervalTimeout is set to 0xFFFFFFFF, and both readTotalTimeoutConstant and readTotalTimeoutMultiplier are zero, a read request completes immediately with the bytes that have already been received, even if no bytes have been received.

If both readIntervalTimeout and readTotalTimeoutMultiplier are set to 0xFFFFFFFF, and readTotalTimeoutConstant is set to a value greater than zero and less than 0xFFFFFFFF, a read request behaves as follows:

  • If there are any bytes in the serial port's input buffer, the read request completes immediately with the bytes that are in the buffer.
  • If there are no bytes in the input buffer, the serial port waits until a byte arrives, and then immediately completes the read request with the one byte of data.
  • If no bytes arrive within the time specified by readTotalTimeoutConstant, the read request times out throwing a timeout exception.

Declaration

interface ISerialTimeouts {
    // Properties
    ${readIntervalTimeout}?: number;
    ${`readTotalTimeoutMultiplier`}?: number;
    ${`readTotalTimeoutConstant`}?: number;
    ${writeTotalTimeoutMultiplier}?: number;
    ${writeTotalTimeoutConstant}?: number;
}
// This interface is not available in managed environment
// This interface is not available in native environment

ISerialTimeouts Properties

readIntervalTimeout

readIntervalTimeout?: number;
// This property is not available in managed environment
// This property is not available in native environment

The maximum amount of time, in milliseconds, that is allowed between two consecutive bytes in a read operation. A read operation that exceeds this maximum times out. This maximum does not apply to the time interval that precedes the reading of the first byte. A value of zero indicates that interval time-outs are not used.

readTotalTimeoutMultiplier

`readTotalTimeoutMultiplier`?: number;
// This property is not available in managed environment
// This property is not available in native environment

The maximum amount of time, in milliseconds, that is allowed per byte in a read operation. A read operation that exceeds this maximum times out.

readTotalTimeoutConstant

`readTotalTimeoutConstant`?: number;
// This property is not available in managed environment
// This property is not available in native environment

The maximum amount of additional time, in milliseconds, that is allowed per read operation. A read operation that exceeds this maximum times out.

writeTotalTimeoutMultiplier

writeTotalTimeoutMultiplier?: number;
// This property is not available in managed environment
// This property is not available in native environment

The maximum total time, in milliseconds, that is allowed per byte in a write operation. A write operation that exceeds this maximum times out.

writeTotalTimeoutConstant

writeTotalTimeoutConstant?: number;
// This property is not available in managed environment
// This property is not available in native environment

The maximum amount of additional time, in milliseconds, that is allowed per write operation. A write operation that exceeds this maximum times out.