title: Truncated data (if more than 512 bytes) when using boost::asio::async_read_until from serial port
body: <p>I'm using the boost::asio::async_read_until function to read from a serial port in Windows 10. The delimiter is a Regex pattern. It works as expected as long as the data recieved is not larger than 512 bytes.</p>
  
  <p>If the data received is larger than 512 bytes, it is simply truncated and the "readComplete" function will not be called again. However if I send more data, 1 byte is enough, the missing data is received together with the new data.</p>
  
  <p>I have used the same implementation on a tcp/socket and that works flawlessly. Is there any limit in the native serial interface in Windows causing this behaviour?</p>
  
  <p>EDIT 1: I have noted that if the baud rate is lowered from 115200 to 28800 no data is missing. </p>
  
  <pre><code>// from .h-file: boost::asio::streambuf streamBuf_;
  
  void RS232Instrument::readAsyncChars()
  {
     boost::asio::async_read_until(
        serial_,
        streamBuf_,
        boost::regex(regexStr_.substr(6, regexStr_.length() - 7)),
        boost::bind(
           &amp;RS232Instrument::readComplete,
           this,
           boost::asio::placeholders::error,
           boost::asio::placeholders::bytes_transferred));
  }
  
  void RS232Instrument::readComplete(const boost::system::error_code&amp; error, size_t bytes_transferred)
  {   
     if(error)
     {
       // Error handling
     }
     else
     {
        std::string rawStr(
           boost::asio::buffers_begin(streamBuf_.data()),
           boost::asio::buffers_begin(streamBuf_.data()) + bytes_transferred);
  
        // Log the data in rawStr....
  
        // Remove data from beginning until all data sent to log
        streamBuf_.consume(bytes_transferred);
  
        if(abort_ == false)
        {
           readAsyncChars();
        }
     }
  }
  </code></pre>