简体   繁体   中英

How to make boost::asio::ip::tcp::acceptor block forever?

How would someone do that? It just blocks until the first connection attempt.

I don't think you can, accept will block until the first connection arrives and async_accept won't block at all (and will only handle the first connection as well). However, why do you want this? You can always initiate another accept once the previous one returned. It's not like you'd miss anything since accept only removes theses connections from the listening sockets queue .

boost::asio::ip::tcp::acceptor::accept 方法已经阻塞,直到尝试连接为止。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM