
Tom Kent wrote:
So, I tried it, but surprisingly, it didn't make any difference. I'm not sure why there wasn't an error, it seems like one of HandleAccept and &HandleAccept would cause some type of error.
Also, I'm not having the problem getting through the acceptor. The server successfully gets the accept callback for the connection from the client (and the client gets its callback as well). Its the aysnc_send/async_read that doesn't ever get a callback. I tried using the reference to HandleAccept in those as well, but like I said above, saw the *exact* same results.
Tom
IIRC, an io_service object is not permitted to make copies of arguments supplied to initiating functions outside its own thread. In your example, you initiate an asynchronous operation from thread A (async_accept), and io_service runs in thread B (io_service.run()). At least, that's if I understood http://tinyurl.com/yhw95xj correctly, the section about whether or not Asio is allowed to make copies of your supplied arguments. Cheers, Rutger