$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] [asio] socket::read_some() splits data into two parts.
From: Slav (slavmfm_at_[hidden])
Date: 2011-05-11 08:28:47
Hello.
I sent 8004 bytes to server through TCP connection and successfully read it
like this:
int readBytes;
const int BUFFER_SIZE = 128;
char charBuf[BUFFER_SIZE];
do
{
readBytes = socket.read_some(boost::asio::buffer(charBuf,
BUFFER_SIZE));
}
while(readBytes >= BUFFER_SIZE);
But sometimes this code reads just 3752 (precisely) bytes and returns. After
that it handles another async_read and reads 4525 bytes (which in sum gives
8004 bytes).
Do I use "read_some()" function in the right way?