|
Boost Users : |
Subject: [Boost-users] Boost.Asio extensible to non network i/o?
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-06-01 00:12:35
I've been reading over the documentation for Boost.Asio and as far as I can
tell the documentation makes no mention whatsoever about using Asio for
anything other than sockets programming. Suppose I wanted to implemented a
simple file transfer client (I say client because the server will not be in
C++) that reads files off of the disk and sends them to the server. I'd
like to do it asynchronously. What would be the basic steps needed to do
this with Boost.Asio, if it is indeed even possible? I'd specifically like
it to use I/O Completion Ports on Windows if possible, and whatever on
Linux. I'd like to be able to configure the number of worker threads on the
backend, so that for example I can read from N files at once, or from N
different locations in the same file. I'd also like to have a single
"controller" thread that receives all the events regarding when reads or
writes complete, so that I don't have to use any kind of locking to
synchronize things.
As a final "nice-to-have", I'd like to be able to plug my own types of
"actions" into the model, things that aren't really I/O but that I still
want to execute asynchronously that would sit in between a completed disk
read and the initiation of writing that same data to the socket. Think, for
example, of encrypting the file before sending. I don't want to block on
the encryption, so it would be nice if I could do that asynchronously and
still be notified of its completion through the same interface. I know I
can do all this directly in windows (which is the only system api i'm
intimately familiar with) via IOCP, so I'm hoping something similar can be
achieved with Boost.Asio.
Thanks
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net