Let's imagine one IO thread. on timer event (each second) it pushes X messages to socket with async_write. Also, at this time, the IO thread receives Y messages with async_read through the same socket. Is there any limit in pushing messages with async_write? What it is?
I know nothing about such a limit, but I suspect another issue in your approach: your description sounds like you don't ensure that async_write is complete (i.e. the handler is called) before issuing another one. If my assumption is correct, you might run into various problems, as the order of execution of your async_writes is undefined. The same applies to async_read's. The correct approach would be like this: // pseudo-code!! class connection : public enable_shared_from_this<connection> { public: void send(Data data) { socket_.get_io_service().post(bind(&connection::syncSend, shared_from_this(), data)); } private: void syncSend(Data data) { // enqueue the data and ensure the write is active someContainer_.push_back(data); activeWrite(); } void activateWrite() { if (!activeWrite_ && unsentDataExists) { activeWrite_ = true; socket_.async_write(allTheData, bind(&connection::sent, shared_from_this(), _1)) } } void sent() { activeWrite_ = false; activateWrite(); } };