serial-rs icon indicating copy to clipboard operation
serial-rs copied to clipboard

set COMMTIMEOUTS for POSIX-like read timeout behavior on Windows

Open carstenandrich opened this issue 5 years ago • 2 comments

The current read timeout behavior implemented by serial-windows differs significantly from the read timeouts of serial-unix. On Windows, read calls do not return immediately when bytes are/become available, but instead wait for the timeout to expire. In contrast, on Linux (tested, but should be true for all POSIX systems) read calls return as soon as bytes are available. Particularly for interactive implementations, the Windows behavior is suboptimal.

This pull request implements the POSIX-behavior on Windows by setting up COMMTIMEOUTS accordingly (see Windows API documentation).

carstenandrich avatar Apr 29 '20 13:04 carstenandrich

@carstenandrich Thanks. The Windows implementation is intended to behave the same as the POSIX implementation. I'll need to find some time to setup a Windows VM to reproduce and verify the fix. If everything checks out, I can merge this.

dcuddeback avatar Apr 29 '20 14:04 dcuddeback

Any updates on this?

RisinT96 avatar Dec 12 '21 22:12 RisinT96