<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QUdpSocket Multicast can&#x27;t receive]]></title><description><![CDATA[<p dir="auto">QUdpSocket Multicast can't receive, but problem is not found.<br />
It's not that I can't do it completely, I can receive it by setting Metric from the network settings.</p>
<p dir="auto">My code:</p>
<pre><code>    m_pUdpSockRecv = new QUdpSocket(this);

    connect(m_pUdpSockRecv, SIGNAL( readyRead() ), this, SLOT( fnUdpRecvData() ));
    m_pUdpSockRecv-&gt;bind( QHostAddress( m_strLocalIp ) , m_numConnectPort, QAbstractSocket::DefaultForPlatform); 
    m_pUdpSockRecv-&gt;joinMulticastGroup( QHostAddress( m_strConnectHostIp ) );

</code></pre>
<p dir="auto">The problem is that even though both <strong>bind</strong> and <strong>joinMulticastGroup</strong> are true, <strong>readyRead</strong> is not emitted.<br />
I've already confirmed that I'm receiving at Wireshark, the firewall is turned off, and the ping with the destination goes through.</p>
<p dir="auto">The only thing I can think of is the Multicast setting, but is there some special setting I need to do?</p>
<p dir="auto">My environment:<br />
OS: Windows 10<br />
Qt : 5.15.0<br />
Kit: MSVC2019 64bit</p>
]]></description><link>https://forum.qt.io/topic/126575/qudpsocket-multicast-can-t-receive</link><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 02:34:30 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/126575.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 May 2021 05:24:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Thu, 23 Sep 2021 17:09:33 GMT]]></title><description><![CDATA[<p dir="auto">also::</p>
<p dir="auto"><a href="https://stackoverflow.com/questions/19218994/qt-joinmulticastgroup-for-all-interface" target="_blank" rel="noopener noreferrer nofollow ugc">https://stackoverflow.com/questions/19218994/qt-joinmulticastgroup-for-all-interface</a></p>
<p dir="auto">Helps to use the various indications/flags in the QNetworkInterface object also.</p>
]]></description><link>https://forum.qt.io/post/681859</link><guid isPermaLink="true">https://forum.qt.io/post/681859</guid><dc:creator><![CDATA[ThirdStrand]]></dc:creator><pubDate>Thu, 23 Sep 2021 17:09:33 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Thu, 23 Sep 2021 18:09:41 GMT]]></title><description><![CDATA[<p dir="auto">Interesting:</p>
<p dir="auto">In Linux Qt 5.15.0 (same version) gcc, binding to the Multicast IPv4 QHostAddress works, then join to the multicast group with the same address.  MC datagrams flow like butter!</p>
<p dir="auto">There are evidently significant differences in how UDP and Multicast work between the two OS's.</p>
<p dir="auto">In Windows here is what is working for me now (and hopefully will also work in Linux).  It feels sort of brute force, but happily now things are consistently working in Windows.  This is sort of the hard way, but demonstrates how to navigate the various properties and flags.   One could just as easily only look at the addresses list and choose the address that you bound the UDP socket to originally.</p>
<pre><code>// Windows is weird
    QList&lt;QNetworkInterface&gt; interfaces = QNetworkInterface::allInterfaces();
    // Try the multicast UDP socket for SA first
    saMC = new QUdpSocket(this);
    saMC-&gt;setSocketOption(QAbstractSocket::LowDelayOption, 1);
    //saMC-&gt;setSocketOption(QAbstractSocket::KeepAliveOption, 1);
    connect(saMC, &amp;QUdpSocket::readyRead, this, &amp;Commander::handleDatagram, Qt::UniqueConnection);
    if(saMC-&gt;bind(QHostAddress("192.168.0.51"), 6969, QUdpSocket::ShareAddress|QUdpSocket::ReuseAddressHint))
    {
        foreach(QNetworkInterface interface, interfaces)
        {
            qDebug()&lt;&lt;"interface:"&lt;&lt;interface.isValid()&lt;&lt;interface.flags();
            QNetworkInterface::InterfaceFlags iflags = interface.flags();
            if(interface.isValid() &amp;&amp; !iflags.testFlag(QNetworkInterface::IsLoopBack) &amp;&amp; iflags.testFlag(QNetworkInterface::CanMulticast) &amp;&amp; iflags.testFlag(QNetworkInterface::IsRunning))
            {

                QList&lt;QNetworkAddressEntry&gt; addressEntries = interface.addressEntries();
                for (int i = 0; i &lt; addressEntries.length(); i++) {
                    QNetworkAddressEntry ae = addressEntries.at(i);
                    if (ae.ip().protocol() == QAbstractSocket::IPv4Protocol)
                    {
                        qDebug()&lt;&lt;"\nSA bound...join mc group:"&lt;&lt;saMC-&gt;joinMulticastGroup(QHostAddress("239.2.3.1"), interface);
                    }
                    else
                    {
                        qDebug()&lt;&lt;"\nSA bound...failed to join mc group on interface:"&lt;&lt;addressEntries[i].ip();
                    }
                }
            }
        }
    }
    else
    {
        qDebug()&lt;&lt;"SA multicast socket unable to bind...."&lt;&lt;saMC-&gt;errorString();
    }
</code></pre>
]]></description><link>https://forum.qt.io/post/681847</link><guid isPermaLink="true">https://forum.qt.io/post/681847</guid><dc:creator><![CDATA[ThirdStrand]]></dc:creator><pubDate>Thu, 23 Sep 2021 18:09:41 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Thu, 23 Sep 2021 13:36:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a> , you are not alone.  This is a very frustrating situation.</p>
<p dir="auto">Anyone have any repeatable configuration/solution?  The Metric "trick" is not working in Win10 Pro 20H2.  At least for not more than one time of program execution after a full reboot.</p>
<p dir="auto">Bind to the IPv4 address (Ethernet nic) and specific port is successful, and shows in netstat.  Joining the multicast group is reported successful by QUdpSocket also.  No firewall in the picture. EDIT: Wireshark shows that the data is flowing periodically as expected.</p>
<p dir="auto">Whether Qt pops readyRead is a crap shoot.  It happens once in a while as expected and I think I have it "fixed", then a restart of the program causes it to fail once again.</p>
<p dir="auto">Example "multicastreceiver" application has never worked on Win10 for me.</p>
<p dir="auto">Qt 5.15.0 MinGW 64 bit, Win10 Pro</p>
]]></description><link>https://forum.qt.io/post/681825</link><guid isPermaLink="true">https://forum.qt.io/post/681825</guid><dc:creator><![CDATA[ThirdStrand]]></dc:creator><pubDate>Thu, 23 Sep 2021 13:36:32 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Thu, 13 May 2021 00:13:16 GMT]]></title><description><![CDATA[<p dir="auto">@naesh<br />
From the Control Panel, in the Network Settings, uncheck "Automatic Metric" and set the metric for the interface to 1.<br />
For more information on metrics, see the following.</p>
<p dir="auto"><a href="https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/automatic-metric-for-ipv4-routes" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/automatic-metric-for-ipv4-routes</a></p>
]]></description><link>https://forum.qt.io/post/659470</link><guid isPermaLink="true">https://forum.qt.io/post/659470</guid><dc:creator><![CDATA[w.tkm]]></dc:creator><pubDate>Thu, 13 May 2021 00:13:16 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Thu, 13 May 2021 00:01:27 GMT]]></title><description><![CDATA[<p dir="auto">@w-tkm what does this mean?</p>
<pre><code>I can receive it by setting Metric from the network settings.
</code></pre>
<p dir="auto">in what setting you are able to receive it?</p>
<p dir="auto">Do mean by adding "route add ?"</p>
]]></description><link>https://forum.qt.io/post/659468</link><guid isPermaLink="true">https://forum.qt.io/post/659468</guid><dc:creator><![CDATA[nagesh]]></dc:creator><pubDate>Thu, 13 May 2021 00:01:27 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Thu, 13 May 2021 02:33:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nagesh">@<bdi>nagesh</bdi></a><br />
<s>I've already tried running it.<br />
I used an example application for the sender as well, but only the first time the <strong>readyRead</strong> emitted.<br />
It must have been sent many times, but only the first time.<br />
And what I am wondering is that if I run the receiver first, it will not receive.</s><br />
Sorry, example application can receive.<br />
However, the data sent by sender my application is not received by receiver qt example application.<br />
My sender application is written in VC++.</p>
<p dir="auto">yes,I use multicast series ip address.<br />
I use 239.0.0.20</p>
]]></description><link>https://forum.qt.io/post/659467</link><guid isPermaLink="true">https://forum.qt.io/post/659467</guid><dc:creator><![CDATA[w.tkm]]></dc:creator><pubDate>Thu, 13 May 2021 02:33:44 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Wed, 12 May 2021 23:23:16 GMT]]></title><description><![CDATA[<p dir="auto">@w-tkm said in <a href="/post/659258">QUdpSocket Multicast can't receive</a>:</p>
<pre><code>m_pUdpSockRecv-&gt;joinMulticastGroup( QHostAddress( m_strConnectHostIp ) )
</code></pre>
<p dir="auto">@w-tkm The address used in Joinmulticastgroup is multicast series ip address right?</p>
]]></description><link>https://forum.qt.io/post/659466</link><guid isPermaLink="true">https://forum.qt.io/post/659466</guid><dc:creator><![CDATA[nagesh]]></dc:creator><pubDate>Wed, 12 May 2021 23:23:16 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Wed, 12 May 2021 23:14:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/raven-worx">@<bdi>raven-worx</bdi></a><br />
I have checked them over and over again, all the basic issues have been checked.<br />
There is absolutely no problem with them.</p>
]]></description><link>https://forum.qt.io/post/659465</link><guid isPermaLink="true">https://forum.qt.io/post/659465</guid><dc:creator><![CDATA[w.tkm]]></dc:creator><pubDate>Wed, 12 May 2021 23:14:42 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Wed, 12 May 2021 12:54:33 GMT]]></title><description><![CDATA[<p dir="auto">@w-tkm Did you try running multicast receiver qt example application?</p>
]]></description><link>https://forum.qt.io/post/659379</link><guid isPermaLink="true">https://forum.qt.io/post/659379</guid><dc:creator><![CDATA[nagesh]]></dc:creator><pubDate>Wed, 12 May 2021 12:54:33 GMT</pubDate></item><item><title><![CDATA[Reply to QUdpSocket Multicast can&#x27;t receive on Wed, 12 May 2021 12:20:26 GMT]]></title><description><![CDATA[<p dir="auto">@w-tkm<br />
<s>i guess you should bind on <code>QHostAddress::Broadcast</code> host address</s></p>
<p dir="auto">Make sure that the local ip host address used for bind is correct and the same the multi cast happens.<br />
Also check possible firewall settings.</p>
]]></description><link>https://forum.qt.io/post/659367</link><guid isPermaLink="true">https://forum.qt.io/post/659367</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Wed, 12 May 2021 12:20:26 GMT</pubDate></item></channel></rss>