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=1I'd followed the sample code:
http://qt-project.org/doc/qt-4.8/network-multicastsender-sender-cpp.htmlHere 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)
10.128.2.32.59388 > 239.255.43.21.45454: [udp sum ok] UDP, length 9work:
DCMCASTPORT=45454
udpSocket = new QUdpSocket(this);
udpSocket->bind(DCMCASTPORT);
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)
10.128.2.32.57081 > 239.255.43.21.45454: [udp sum ok] UDP, length 9May this find the way into the demo code.
Happy Hacking!
Chris -
Hi,
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