title: boost::asio error after sending/receiving exactly 128kb
body: <p>I'm developing a client-server app, both sides of which use boost::asio.
  I'm trying to send a large package of data over TCP (356 kb)
  On server side, I write like:</p>
  
  <pre><code>boost::asio::async_write(Msocket, 
      boost::asio::buffer(sendBuffer,dataLen),
      boost::bind(&amp;ServerSession::onDataWrite, 
          this, boost::asio::placeholders::error,
          boost::asio::placeholders::bytes_trasferred));
  </code></pre>
  
  <p>The onDataWrite is simple:</p>
  
  <pre><code>void ServerSession::onDataWrite(const boost::system::error_code&amp; error, const std::size_t bytesSent) {
      if (error) {
          std::cout &lt;&lt; "Error " &lt;&lt; error &lt;&lt; " while sending data" &lt;&lt; std::endl;
      }
  }
  </code></pre>
  
  <p>On client side:</p>
  
  <pre><code>int readSize = ...; // defined from msg header, in this case equals 300 kbytes.
  boost::asio::async_read(*Msocket, 
      boost::asio::buffer(recvBuffer, 50*1024*1024),
      boost::asio::transfer_exactly(readSize),
      boost::bind(&amp;ClientSession::onDataRead, 
          this, boost::asio::placeholders::error,
          boost::asio::placeholders::bytes_trasferred, 
          readSize));
  </code></pre>
  
  <p>And onDataRead is:</p>
  
  <pre><code>void ClientSession::onDataRead(const boost::system::error_code&amp; error, const std::size_t bytesRecvd, const int readSize) {
      if (error || bytesRecvd != readSize) {
          std::cout &lt;&lt; "Error " &lt;&lt; error &lt;&lt; " while getting data, expect " &lt;&lt; readSize &lt;&lt;", got " &lt;&lt; bytesRecvd &lt;&lt; std::endl;
      }
  }
  </code></pre>
  
  <p>During write, server side prints</p>
  
  <pre><code>Error system:10014 while sending data
  </code></pre>
  
  <p>And client prints</p>
  
  <pre><code>Error system:0 while getting data, expect 393216, got 131064
  </code></pre>
  
  <p>While 131064 = 128kb - 8 bytes of header.</p>
  
  <p>It looks like this 128-kb issue is caused by send/receive buffer overflow. But I though Boost will take care about those buffers itself, transparently for me.
  What do I misunderstand?</p>