I understood that ip::tcp::iostream of Boost.Asio can be realize for multi threading interactive server using multiple io_servives; However, it may not be true. In fact, I wrote the following, but ip::tcp::iostream::write is blocking during the stream is reading.
- Main thread (cui thread) creates accepting thread
- The accepting thread creates thread pool for io_service using boost::thread_group.
- The accepting thread creates each communication agent on a thread when a new connection is accepted.
- The agent thread is receiving to client's requests.
Such behavior of client's request and its response is fine as I expect. - However, the server sends requests to clients in some cases. Then, the sending is blocking.
I will change from ip::tcp::iostream to asynchronous sockets of Boost.Asio...
Um, ASIO stads for Asynchronous I/O, which means answer ?
No comments:
Post a Comment