Boost logo

Boost Users :

Subject: Re: [Boost-users] [ASIO] Wrong usage of streambuf ?
From: imran.fanaswala (imranf_at_[hidden])
Date: 2009-12-10 12:24:00

I am not really sure what response_stream is, but I see what you are trying
to do. Consider doing the following instead:

void Client::handle_read(boost::asio::ip::tcp::socket* socket, const
boost::system::error_code& err, size_t bytes_transferred)
  //Note: data, will contain the "ok\r\n".. so just do some string manip to
get rid of it
  const char* data=boost::asio::buffer_cast<const char*>(;

  response_.consume(bytes_transferred); //This is the key...

Axel-41 wrote:
> On 10/12/2009 12:17, Igor R wrote:
>>> Because just before, the 2 bytes of "ok" are consumed by
>>>, message_size) ;
>>> I assume that this read() call consume them, no ?
>> No.
> I tried to consume the amount of bytes transferred (4 in this case),
> without success.
> What makes me think that my problem is stream-related is that when I
> don't try to read the answer from the server, I successful close the
> socket , reconnect, and repeat the process without problem.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at