title: Is there a boost::iostreams (bidirectional) Device for a blocking boost::asio TCP connection?
body: <p>I'm surveying c++ libraries for portable, blocking I/O access to the filesystem and network.  It <em>looks</em> like <code>boost::filesystem</code>, <code>boost::iostreams</code> and <code>boost::asio</code> will, between the three of them, do the job.</p>
  
  <p>To be clear, I'm not currently interested in the asynchronous aspects of <code>boost::asio</code>; I just want a portable, blocking interface to the network.</p>
  
  <p>Digging in, I see <code>boost::iostreams</code> has a notion of Devices, each of which has an associated <a href="http://www.boost.org/doc/libs/1_50_0/libs/iostreams/doc/guide/modes.html" rel="nofollow">mode concept</a>.  The bidirectional mode specifically seems hand-tailored for streaming access to a full-duplex TCP connection.  Awesome.</p>
  
  <p><code>boost::iostreams</code> does not seem to offer support for actually opening TCP connections (unlike the local filesystem.)  That's fine, surely <code>boost::asio</code> will let me open the connection, appropriately model it as a bidirectional <code>Device</code>, and wrap it in a <code>boost::iostreams::stream</code>.</p>
  
  <p>..except it won't?  I see <a href="http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/reference/ip__tcp/iostream.html" rel="nofollow"><code>boost::asio::ip::tcp::iostream</code></a>, which would replace the <code>boost::iostreams::stream</code>, but presumably not act as a <code>Device</code>.</p>
  
  <p>I understand the <code>tcp::iostream</code> 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 &amp; exception hierarchies is not very palatable.</p>
  
  <p>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?</p>