I am using Boost asio 1.48. Is it possible to re-use a single boost::asio::io_service instance for multiple listening sockets that are open simultaneously?
The docs say its share-safe, but I am not sure if that is already a positive answer.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can, and you should. And you can use that same
io_serviceto handle those sockets, handle timers, handle requests youpostto it, and so on. The whole point of anio_serviceis to act as a central dispatcher for work of all kinds.