[英]Can I use the same boost::asio::io_service for multiple listening sockets?
I am using Boost asio 1.48. 我正在使用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? 是否可以为同时打开的多个侦听套接字重用单个boost::asio::io_service
实例?
The docs say its share-safe, but I am not sure if that is already a positive answer. 文档说它的共享安全,但我不确定这是否已经是一个肯定的答案。
Yes, you can, and you should. 是的,你可以,你应该。 And you can use that same io_service
to handle those sockets, handle timers, handle requests you post
to it, and so on. 并且您可以使用相同的io_service
来处理这些套接字,处理定时器,处理post
给它的请求,等等。 The whole point of an io_service
is to act as a central dispatcher for work of all kinds. io_service
是充当各种工作的中央调度员。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.