|
-
August 10th, 2006, 01:12 PM
#1
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.
-
August 8th, 2007, 09:45 PM
#2
Re: Delay encountered while using ReadFile
This is interesting. Pump it and hope some guru can help explain.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|