Click to See Complete Forum and Search --> : Please help me understand COMMTIMEOUTS


cesarsalad
September 28th, 2005, 02:07 AM
I'm writing an application that reads and writes to serial port. Right now I'm implementing reading, and I had a few problems. On the net it was suggested for timeouts to use MAXDWORD for readintervaltimeout, and for the constant and multiplier to use 0 (this is all for read).
I am using an array of size 10000 to hold my data, and I call the ReadFile function with this array and size as arguments (in a while loop, which runs until I press a button to stop sampling). I'm receiving data at about 10000 bytes per second. The problem is when I use the timeouts above, only a low number of bytes get through (let's say anywhere from 500 to 3000) and then the number just stops updating and only that many bytes get through, even though more are being sent.
I then changed it to MAXDWORD for timeout and multiplier, and 50 for the constant - as MSDN suggests (just a number I picked). This then seemed to work, the bytes are being sent at the correct speed, it seems (perhaps a tad slow). What I want to know is why this works and the other doesn't, I don't think I understnad the timeouts, and as this is going to become a more complicated project I feel I need to know what's going on here...
Thank you.