I am making a Boost TCP Server and following this example.
I realised that not all the messages sent by client are received by the server and after further reading i realised the problem lies with this function.
void do_read()
{
auto self(shared_from_this());
socket_.async_read_some(boost::asio::buffer(data_, max_length),
[this, self](boost::system::error_code ec, std::size_t length)
{
if (!ec)
{
do_write(length);
}
});
}
Since we are using socket_.async_read_some this function can exit before reading all the messages.
Can this function be modified or how should i make a server which will read all the incoming messages.
Aucun commentaire:
Enregistrer un commentaire