I'm surveying c++ libraries for portable, blocking I/O access to the filesystem and network. It looks like boost::filesystem
, boost::iostreams
and boost::asio
will, between the three of them, do the job.
To be clear, I'm not currently interested in the asynchronous aspects of boost::asio
; I just want a portable, blocking interface to the network.
Digging in, I see boost::iostreams
has a notion of Devices, each of which has an associated mode concept. The bidirectional mode specifically seems hand-tailored for streaming access to a full-duplex TCP connection. Awesome.
boost::iostreams
does not seem to offer support for actually opening TCP connections (unlike the local filesystem.) That's fine, surely boost::asio
will let me open the connection, appropriately model it as a bidirectional Device
, and wrap it in a boost::iostreams::stream
.
..except it won't? I see boost::asio::ip::tcp::iostream
, which would replace the boost::iostreams::stream
, but presumably not act as a Device
.
I understand the tcp::iostream
would act similarly, but I would still prefer to learn and code against just one interface, not two. Specifically, dealing with two error handling regimes & exception hierarchies is not very palatable.
So, the question: am I blind? Maybe an adapter between the two libraries exists, that I missed googling around. Or perhaps someone has already released such an adapter as a 3rd-party component I could drop in?