Re: [asio-users] Different io_service for TLS handshake and read/write
Brought to you by:
chris_kohlhoff
From: Vinnie F. <vin...@gm...> - 2018-11-30 02:37:34
|
On Thu, Nov 29, 2018 at 5:36 PM Michi Henning via asio-users <asi...@li...> wrote: > However, what I want to do is have the handshake performed by the acceptor thread, > but use a different io_service with its own separate thread to perform all the I/O work After the handshake, submit completion handlers for subsequent operations using bind_handler with the executor of the second io_context. Example: io_context ioc1; tcp::socket sock(ioc1); ... io_context ioc2; sock.async_read_some(buffers, bind_executor(ioc2.get_executor(), [](error_code ec, std::size_t bytes_transferred) { ... } Disclaimer: untested Good luck! |