⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Make setSocketOption + QAbstractSocket::MulticastTtlOption work!

  • Hi Guys,

    I have a small project working and debug the ttl of a multicast udp datagram using tcpdump.
    Its turns out that the
    setSocketOption(QAbstractSocket::MulticastTtlOption,QVariant(4)) has no effect
    tcpdump shows ttl=1

    I'd followed the sample code:

    Here my finding:
    not work:
    udpSocket = new QUdpSocket(this);
    udpSocket->setSocketOption(QAbstractSocket::MulticastTtlOption, QVariant(4));

    11:38:41.994031 IP (tos 0x0, ttl 1, id 6402, offset 0, flags [DF], proto UDP (17), length 37) > [udp sum ok] UDP, length 9

    udpSocket = new QUdpSocket(this);
    udpSocket->setSocketOption(QAbstractSocket::MulticastTtlOption, QVariant(4));

    12:15:43.285005 IP (tos 0x0, ttl 4, id 57649, offset 0, flags [DF], proto UDP (17), length 37) > [udp sum ok] UDP, length 9

    May this find the way into the demo code.

    Happy Hacking!

  • Lifetime Qt Champion


    From the forum it's pretty unlikely that it'l get to the example code however if you would like to update the example, you can provide a patch and contribute it to Qt

Log in to reply