I'm pretty new in asio framework, so please be kind. I've investigated several boost asio example and found that people use async call like this:
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 not safe because it uses multiple recursion. So it cant be used when a lot of read operations are performed because of call stack overflow. I'm not 100% sure in this and unable to find any similar thoughts from other people.
Could anyone please explain this in details?