How to handle receiving an asynchronous socket in C ++?

I am currently using a thread to asynchronously call connections and send. All this works fine, but now I want to make receiving asynchronous. How to get data without pausing the entire queue while waiting for data? The only solution I can think of now is a second thread.

+3
source share
2 answers

Check out non-blocking sockets and polling APIs like select(2)/ poll(2)/ epoll(4)/ kqueue(2).

In particular, in C ++ browse boost::asio.

+6
source

, , - select.

.

+1

Source: https://habr.com/ru/post/1749458/


All Articles