I am new to asio infrastructure, so please be kind. I researched several examples of boost asio and found that people use asynchronous calling as follows:
void read() { async_read(socket_, boost::asio::buffer(&user_[0], user_.size()), boost::bind(&Connection::handle_user_read, this, placeholders::error, placeholders::bytes_transferred)); } void handle_user_read(...) { ... read(); ... }
I think this code is unsafe because it uses multiple recursion. Therefore, it cannot be used when many read operations are performed due to calls. I am not 100% sure of this and cannot find similar thoughts in other people.
Can someone explain this in detail?
source share