Delay encountered while using ReadFile
Hi,
I am using ReadFile to read on a serial com port. At any given time, the bytes available to read are not more that 100.
ReadFile(hFile, &inBuffer, nBytesToRead, &nBytesRead, NULL);
When I use this funciton in the following steps:
1. Find out how many bytes are available to read and store it in nBytesToRead.
2. Call ReadFile(hFile, &inBuffer, nBytesToRead, &nBytesRead, NULL);
This function returns almost instantaneously after reading nBytesToRead bytes.
But when I use in this way:
1. Call ReadFile(hFile, &inBuffer, 1024, &nBytesRead, NULL);
1024 is any random number. This function, tough reads the available number of bytes in the port, it takes 2000ms more to return.
Can anyone please explain, why there is this additional delay being introduced ?
Thanks,
Mihir.
Re: Delay encountered while using ReadFile
This is interesting. Pump it and hope some guru can help explain.