Important: Please read the Qt Code of Conduct -

Network - QUdpSocket::setSocketOption, doesn´t work

  • Hi,
    setSocketOption is useful function. I have used it for extension rcv and snd buffer in QUdpSocket, because i had problem with fast incoming packets and losing it, here is the code:
    udpSocket->setSocketOption(QAbstractSocket::SendBufferSizeSocketOption, SNDBUF_SIZE_UDP); udpSocket->setSocketOption(QAbstractSocket::ReceiveBufferSizeSocketOption, RCVBUF_SIZE_UDP);

    It works fine, when app are running on the same PC with local addresses If I trying it on two PC throw local network, that functions doesn´t work. Default buffer for QUdpSocket has 8 kB and it is very few. I am using Qt ver 5.3.
    Thanks for your advice,

  • I have tried, if the parameters were correct set. In case ReceiveBufferSizeSocketOption was and SendBufferSizeSocketOption wasn´t. This is reason, why it was fine on same PC and with incoming mistakes with two PC. Have you got any idea, what could be wrong on udpSocket->setSocketOption(QAbstractSocket::SendBufferSizeSocketOption, SNDBUF_SIZE_UDP)? Thank you,

Log in to reply