Skip to content
Search

WindowsApi:COMMTIMEOUTS

lastmod 2018-08-17created 2018-07-313 edits

Syntax

typedef struct _COMMTIMEOUTS {
  DWORD ReadIntervalTimeout;
  DWORD ReadTotalTimeoutMultiplier;
  DWORD ReadTotalTimeoutConstant;
  DWORD WriteTotalTimeoutMultiplier;
  DWORD WriteTotalTimeoutConstant;
} COMMTIMEOUTS, *LPCOMMTIMEOUTS;

Properties

ReadIntervalTimeout
Specifies the interval timeout between one byte and the next, i.e., between two bytes. If this value is 0, the timer is not used.
ReadTotalTimeoutMultiplier
Timeout multiplier for the entire Read. This value is multiplied by the number of bytes requested for the Read.
ReadTotalTimeoutConstant
Timeout constant for the entire Read. This value is the minimum timeout applied by default to the timeout for a Read.
WriteTotalTimeoutMultiplier
Timeout multiplier for the entire Write. This value is multiplied by the number of bytes requested for the Write.
WriteTotalTimeoutConstant
Timeout constant for the entire Write. This value is the minimum timeout applied by default to the timeout for a Write.

Calculating the timeout value

When a Read of n bytes is requested, the timeout applied to the entire Read is as follows.

Total Timeout = ReadTotalTimeoutConstant + (ReadTotalTimeoutMultiplier * n);

Returning immediately

With the values set as below, the call returns immediately even if no data has been received.

ReadIntervalTimeout = MAXDWORD;
ReadTotalTimeoutMultiplier = 0;
ReadTotalTimeoutConstant = 0;

See also

Favorite site