Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] async_read and 100% CPU
From: Michael Caisse (boost_at_[hidden])
Date: 2009-06-30 14:34:42


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

-- 
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.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