Serial Port I/O

Started by
11 comments, last by doctorsixstring 21 years, 9 months ago
Should that return an error different than ''invalid parameter''? Maybe it''s fubar on 9x - well actually we all know the comm API is fubar on 9x, but maybe the error codes don''t work either.

Overlapped IO was one of the first forms of event driven asycronous IO for Windows. It''s supported on 9x & NT kernels. On NT you have other asyncronous options that have less overhead. RS-232 is a good place to use overlapped IO. It minimizes your latency from the time data is received to the time your applications knows about it. In high-bandwidth applications overlapped IO can actually degrade performance over polling (because overlapped IO can trigger thousands of times per second, whereas you would poll upto hundreds of times per second)

I also use
m_hComFile = CreateFile(m_strComPort, GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); 
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
A way to check whether the CreateFile was successful: If it failed, the output (the handle to the port) returns INVALID_HANDLE_VALUE. Just check for this to see if CreateFile was successful.
BTW, "COM2" is correct.

blw
640 kByte of memory is all that any application should ever need(Bill Gates 1981)
Isn''t there a way to use the socket API interface over a COM layer? Writing COM apps with the serial API is going to introduce a lot of headaches if you want reliable transmissions. Sockets are good because it handles all the retransmissions for you.

This topic is closed to new replies.

Advertisement