Click to See Complete Forum and Search --> : COMTIMEOUT


May 14th, 1999, 04:43 PM
When configuring a file I/O (in my case to serial COMx ports) COMMTIMEOUTS
are set up.

What happens when a COMTIMEOUT happens ? How can I see that/if it has
happend ?


Thanks in advance

-- Eigil

Randy C
May 15th, 1999, 12:52 AM
COMMTIMEOUTS affects the behavior of the ReadFile() and WriteFile() calls in different ways depending on weather or not you are opening the COMM port in OVERLAPPED or NON-OVERLAPPED. Mode. In OVERLAPPED Mode for example, the ReadIntervalTimer is normally set to a minimal non-zero number (1) to force the Read operation to return an IO_PENDING status when there is no data to be read. You then usually wait for a read event to occur with a WaitForMultipleEvents() call, which has it's own preset timeout for the event associated with the Read operation's OVERLAPPED structure.

It is somewhat complex to understand serial communications now that OVERLAPPED I/O and multithreading is the considered the correct approach. Fortunately, there is a great article that not only explains the whole matter in detail, but includes a fine terminal application project to pull it all together. IT's called " Serial Communications in Win32" and may be downloaded at:

http://msdn.microsoft.com/library/techart/msdn_serial.htm

--Randy C
* * * Second star to the Right!