Important: Please read the Qt Code of Conduct -

How to avoid excessive UDP packet loss -- for your information

  • Hello,

    my application suffered from udp packet loss at busy moments.
    Of course udp is not reliable, I know, but it lost many packets
    that wireshark did see arrive on my pc.

    I found a simple solution for that, within qt :
    Since QT5.3, you can set this socket option : QAbstractSocket::ReceiveBufferSizeSocketOption
    I updated to QT5.3, and set the OS socket receive buffer to a huge 2M bytes :
    This solved the packet loss, the default receive buffer is probably quite small.
    See code below.

    connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));

  • Moderators

    Oh my, if I had found that out 2 months ago, it would have spared me some huge refactoring...

    anyway, this is a great find, thanks a lot for sharing.

Log in to reply