I'm trying to put together a proof of concept for reading/writing to a serial port and I am having problems with design/concept. I don't want to poll, so I'm trying to use Overlapped I/O. In this case, it's not a multi-threaded application - it just uses efficient waits.
The MSDN example is kind of lame (Monitoring Communications Events). I'm currently using two events, but the ReadFile
step is failing with ERROR_INVALID_PARAMETER
.
In the steps above, do I need one or two overlapped structures? If one OVERLAPPED
structure, are the steps WriteFile
, WaitCommEvent
(for write), reset event, WaitCommEvent
(for read), ReadFile
?
Have a look at this article, it is much more thorough about how to use overlapped I/O with serial ports:
Serial Communications
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With