Boost logo

Boost :

Subject: Re: [boost] [asio] Pass some parameter to io_service::run
From: Sergei Politov (spolitov_at_[hidden])
Date: 2010-01-10 00:48:09


> I need to pass reference to this object to the socket::async_receive
> complete routine to complete message processing. This object allocates a
> lot
> of memory and I cannot create it for every socket. It is possible to create
> but there is no sense.

  You can pass them using boost::bind:
   socket_.async_read_some(boost::asio::buffer(data_, max_length),
        boost::bind(&session::handle_read, this,

  void session::handle_read(const boost::system::error_code& error, size_t
bytes_transferred, LargeObject & largeObject)

Best Regards,

Boost list run by bdawes at, gregod at, cpdaniel at, john at