user502230
user502230

Reputation:

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

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

Upvotes: 0

Views: 879

Answers (2)

yonilevy
yonilevy

Reputation: 5428

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.

Upvotes: 6

Sam Miller
Sam Miller

Reputation: 24164

the boost::asio::ip::tcp::acceptor::accept method already blocks until a connection is attempted.

Upvotes: 0

Related Questions