jacobsa / go-serial

A Go library for dealing with serial ports.
Apache License 2.0
631 stars 121 forks source link

Windows Timeout in Milliseconds #24

Open tiagolone opened 7 years ago

tiagolone commented 7 years ago

In Windows implementation, timeout value is being divided by 100:

timeoutConstant := uint32(round(float64(options.InterCharacterTimeout) / 100.0))

It is explained by the following commentary: "The documentation states that ReadIntervalTimeout is set in MS but empirical investigation determines that it seems to interpret in units of 100ms."

But I don't think it is correct. In my tests, windows is interpreting it as MS, not 100s of MS, as stated in the documentation. Which Windows version was used for your tests?

For example, in my machine, I have to set a timeout of 200000 to achieve 2 seconds timeout. I am using Windows 10. I have some experiece with serial communication in Windows, but with other languages.

jacobsa commented 7 years ago

That's from a pull request written by @matevzmihalic. I don't know anything about it. Please feel free to fix it if the documentation and your experimentation both agree.