|
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*>(datastream.data());
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
>>> response_stream.read(response_char, 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]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
-- View this message in context: http://old.nabble.com/-ASIO--Wrong-usage-of-streambuf---tp26695276p26731226.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net