How to run boost asio resolver service on more threads?

后端 未结 2 614
离开以前
离开以前 2021-01-15 05:16

I am using boost::asio::ip::udp::resolver in an SNMPV2 implementation to determine wheather a host is reachable or not.

using Resolver = boost::asio::ip::udp         


        
2条回答
  •  梦谈多话
    2021-01-15 05:51

    What you need are two io_service ioService, because each one is run by a thread. By that I mean that you block the normal execution of a thread by calling io_service::run.

    I think that the code itself is correct.

提交回复
热议问题