
Hello Sergey, Thank you for your participation. In this case I should create LargeObject for every socket because I don't know what thread of the pool will process incoming message. And I cannot pass the same largeObject to two or more recv operations. Looks like I should use null_buffers. What is overhead of this way? Should I go to the kernel twise (1st - socket::async_recv, 2nd - socket::recv)? The best way for me is, if asio will repeat the Windows Async I/O interface and let me call completion routine directly. 2010/1/10 Sergei Politov <spolitov@gmail.com>
Hi,
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, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred, boost::ref(largeObject)));
Where: void session::handle_read(const boost::system::error_code& error, size_t bytes_transferred, LargeObject & largeObject) { ...... }
Best Regards, Sergei _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost