Asio v 1.11。文档说 basic_stream_socket::get_io_service()
不推荐使用成员函数和 get_executor()
必须改用。但后者返回 executor
不是 io_service
.
如何获取引用io_service
套接字使用的对象来构造另一个对象?
最佳答案
您可以使用 get_executor().context()
:
socket newSocket(existingSocket.get_executor().context()));
关于boost-asio - 已弃用的 get_io_service() 的替代方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39445636/