Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] async_read and 100% CPU
From: Etienne Philip Pretorius (icewolfhunter_at_[hidden])
Date: 2009-06-30 14:46:02


Michael Caisse wrote:
> Hi Etienne -
>
> Etienne Philip Pretorius wrote:
>> Hello list,
>>
>> Could someone please shed some light on this subject. It seems that me
>> read handler keeps on being called even when there has been no data
>> transferred...
>>
>> switch(error.value()) {
>> case boost::system::posix_error::success: {
>> c = new client();
>>
>> socket.async_receive(
>> boost::asio::buffer(
>> buffer
>> ),boost::bind(
>> &client::handle_read,
>> this,
>> boost::asio::placeholders::error,
>> boost::asio::placeholders::bytes_transferred
>> )
>> );
>
>
> Try changing this to use socket.async_read_some instead of async_receive.
>
> Regards -
> michael
>
>
:D, just tried it - still no luck.
I am invesigating if I am calling the buffer correctly. It seems that
after the call to async_receive/async_read_some that there is still data
pending for me to read... IE I never seem to get the data placed inside
the std::vector correctly.

Kind Regards,
Etienne


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