Is there a proper way for implementation of a Real-time Boost.Asio TCP socket?

I am developing a code to connect to my microcontroller board that is sending packets of size 30KB at 0.1/second intervals constantly. So far I use the following API for reading from TCP stream:

socket_.async_read_some
    (
        boost::asio::buffer(data, DATA_BUFFER_SIZE),
        boost::bind
        (
            &connectionHandler::handle_read,
            shared_from_this(),
            boost::asio::placeholders::error,
            boost::asio::placeholders::bytes_transferred
        )
    );

The problem is that I am receiving every 18 packets or sometimes even more, and all the packets in between are lost/dropped. Is there a specific routine to follow or certain things to avoid for getting as least delay as possible? I would appreciate any helps or possible similar open source examples to follow and learn how to achieve this with Boost.Asio. Thank you

Read more here: Source link