SetPortTimeOuts

BOOL SetPortTimeOuts(
    HANDLE          hPort,
    LPCOMMTIMEOUTS  lpCTO,
    DWORD           reserved    // must be set to 0
);
 

Sets time out values on an open port.

hPort The handle of the port on which to set the time out values.
lpCTO Points to a communications timeout (COMMTIMEOUTS) structure that contains the timeout values to set.
reserved Reserved for future use. Must be set to 0.

The COMMTIMEOUTS structure definition is shown below:

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

For a full definition of each of the members of the COMMTIMEOUTS structure, see the Win32 Software Development Kit (SDK). Brief definitions for each of the members of the COMMTIMEOUTS structure are:

ReadIntervalTimeout Specifies the maximum time, in milliseconds, allowed to elapse between the arrival of two characters. A value of 0 indicates interval time-outs are not to be used.
ReadTotalTimeoutMultiplier The multiplier value, in milliseconds, used to calculate the total timeout period for read operations. For each read operation, this value is multiplied by the requested number of bytes.
ReadTotalTimeoutConstant The constant value, in milliseconds, used to calculate the total timeout period for read operations. For each read operation, this value is added to the product of the value in ReadTotalTimeoutMultiplier and the requested number of bytes.
WriteTotalTimeoutMultiplier The multiplier value, in milliseconds, used to calculate the total timeout period for write operations. For each write operation, this value is multiplied by the number of bytes to be written.
WriteTotalTimeoutConstant The constant value, in milliseconds, used to calculate the total timeout period for write operations. For each write operation, this value is added to the product of the value in WriteTotalTimeoutMultiplier and the number of bytes to be written.