mercredi 20 octobre 2021

How to check return type of boost asio async_read_some, async_write_some

I want to check if async_read_some, async_write_some or any other async function is a success. I am aware of the boost::asio::placeholders::error param available in the handler. But does the async call, as such, not have a return type? I read about completion_condition, but am not aware of how to use it. Any simple code sample would be helpful.

                mSock.async_read_some(
                        boost::asio::buffer(mI8Data, MAX_BUFFER_LENGTH),
                        boost::bind(&ConnectionHandler::HandleRead,
                            shared_from_this(), 
                            boost::asio::placeholders::error,
                        boost::asio::placeholders::bytes_transferred));

I basically want something that tells me if the async_read_some call is facing any issue.

Aucun commentaire:

Enregistrer un commentaire