Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Asio extensible to non network i/o?
From: Kevin Scarr (kscarr_at_[hidden])
Date: 2009-06-01 08:18:22


Zachary Turner wrote:
> 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.

Boost.Asio supports serial ports as well.

> 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?

There are examples of client / server applications, and although based
on sockets, with appropriate modifications could run over, say, serial
ports.

>
> 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.

I use Boost.Asio not only for sockets, serial ports, and files, but also
to implement asynchronous message passing between threads. This involves
using io_service.post() to post functor objects to the thread. I usually
use the "active object" kind of idiom in this case.

Anyway, my point is that I believe Boost.Asio can be used for the kinds
of things that you describe.

Kevin


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