1

I need to write objects, sent to me from another process, to several files on my disk. Each object comes with fileID (the name of file to be written in to) and chunks of data.

I would like to use IO completion port (IOCP) in order to optimize the files writing, using concurrent asynchronous I/O, but I have to write each file, synchronically, e.g. I have to keep the chunk order per-file when writing to disk but not files order.

I understand that .Net using IOCP whenever it does an IO operation but how do i make it work the way I want?

choppy
  • 739
  • 1
  • 12
  • 22

1 Answers1

0

This is easy to do, you just need to track the write position for each file and update it as you write each chunk. You specify the write offset in the OVERLAPPED structure for async writes and so as long as you track where you are in each file you should be able to just write the chunks and update your per file write offset.

Len Holgate
  • 21,282
  • 4
  • 45
  • 92