Boost logo

Boost Users :

Subject: Re: [Boost-users] boost asio async_read_some
From: Igor R (boost.lists_at_[hidden])
Date: 2008-12-04 02:44:44


>
> Here's a simplified version of my call and handler:
>
> unsigned char tmpBuffer[512]; //global
>
> void MyClass::handler(const boost::system::error_code& error, size_t
> bytes_transferred)
> {
> boost::system::error_code e;
> std::cerr << "handler called()" << "\n";
> }
>
> void MyClass::test()
> {
>
> ...
> socketPtr->async_read_some(boost::asio::buffer(tmpBuffer, 512),
> boost::bind(&MyClass::handler, this,
> boost::asio::placeholders::error,
>
> boost::asio::placeholders::bytes_transferred));
> }
>
> Can anyone give me any idea as to how I can get my handler to be called?
>

Could you please provide some code-excerpt that should compile and work?
I.e. code that contains socket initialization, io_service run and your
object creation - because the mistake is probably somewhere at those points.

> Invocation of the handler will be performed in a
> manner equivalent to using boost::asio::io_service::post()." I'm not
> sure exactly what this means...what is this equivalent manner that is
> mentioned?

It means that the handler would be invoked in one of the threads that run
the io_service object used by the socked.



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