Re: overlapped IO problem



You have 2 options:

1. Wait on event, specified in OVERLAPPED structure. You are able to
use either ReadFile() or ReadFileEx() if you do it this way

2. Do nothing at all - when IO operation gets completed, your IO
completion routine gets invoked. You have to use only ReadFileEx() if
you do things this way

Don't forget that Memory Manager works synchronously, so that
asynchronous IO without
FILE_FLAG_NO_BUFFERING just does not make sense. Therefore, in addition
to FILE_FLAG_OVERLAPPED flag, you should specify FILE_FLAG_NO_BUFFERING
in CreateFile() call

Anton Bassov

Roland wrote:
Hello,
Copying a file involves reading data from source file and writing it
into destination file. I have one big file from network driver that I
am copying to local under high latency conditions.

Here is the code

// open source file

// open destination file

while (sourcefilesize)
{

// read data from source file into chunks of 64KB

// write the data into destination file

}


Now I want to make this operation asnchronous using OVERLAPPED IO.
Could someone tell how could I use overlapped IO to make this thing
asnchronous.
How to wait for all operation which are pending ? I am little bit
confused over here. Could someone shed some light on this problem ?

Thanks,
Ajay

.



Relevant Pages