<?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 bind]]></title><description><![CDATA[<p dir="auto">HI,</p>
<p dir="auto">socket = new QUdpSocket;<br />
socket-&gt;bind(QHostAddress::Any,12345);</p>
<p dir="auto">In place of QHostAddress::Any ,need to add specific IP addresses (i.e., 192.168.1.18,192.168.1.19, 192.168.1.21) instead of accepting all the IP addresses.<br />
I want to bind fixed 3 IP addresses only.<br />
Thank you .</p>
]]></description><link>https://forum.qt.io/topic/66628/qudpsocket-bind</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 20:51:41 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/66628.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 02 May 2016 07:16:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QudpSocket bind on Mon, 02 May 2016 07:47:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yuvaram">@<bdi>yuvaram</bdi></a> said:</p>
<blockquote>
<p dir="auto">You mean that there it need to create 3 different sockets and bind it.</p>
</blockquote>
<p dir="auto">Yep, you're right - I meant three separate sockets, each bound once :)</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://forum.qt.io/post/325141</link><guid isPermaLink="true">https://forum.qt.io/post/325141</guid><dc:creator><![CDATA[Paul Colby]]></dc:creator><pubDate>Mon, 02 May 2016 07:47:23 GMT</pubDate></item><item><title><![CDATA[Reply to QudpSocket bind on Mon, 02 May 2016 07:43:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul-colby">@<bdi>Paul-Colby</bdi></a><br />
You mean that there it need to create 3 different sockets and bind it.<br />
thank you.</p>
]]></description><link>https://forum.qt.io/post/325140</link><guid isPermaLink="true">https://forum.qt.io/post/325140</guid><dc:creator><![CDATA[yuvaram]]></dc:creator><pubDate>Mon, 02 May 2016 07:43:22 GMT</pubDate></item><item><title><![CDATA[Reply to QudpSocket bind on Mon, 02 May 2016 07:46:02 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/yuvaram">@<bdi>yuvaram</bdi></a>,</p>
<blockquote>
<p dir="auto">I want to bind fixed 3 IP addresses only.</p>
</blockquote>
<p dir="auto">As far as I know, the underlying OS sockets (on Linux, at least) only support <strong>one</strong> or <strong>all</strong> interfaces for a single bind.  Qt probably doesn't extend on that.</p>
<p dir="auto">So I think you would need to have three separate UDP binds, but you can connect them all to the same slot anyway, like:</p>
<pre><code>MyClass::MyClass() {
    for (const QHostAddress &amp;address, addresses) {
        QUdpSocket * const socket = new QUdpSocket(this);
        connect(socket, SIGNAL(readyRead()), this, SLOT(mySlot()));
        socket-&gt;bind(address, 12345);
    }
}

void MyClass::mySlot() {
    QUdpSocket * const socket = qobject_cast&lt;QUdpSocket *&gt;(sender());
    Q_CHECK_PTR(socket);
    // do stuff with socket.
}
</code></pre>
<p dir="auto">Cheers.</p>
]]></description><link>https://forum.qt.io/post/325139</link><guid isPermaLink="true">https://forum.qt.io/post/325139</guid><dc:creator><![CDATA[Paul Colby]]></dc:creator><pubDate>Mon, 02 May 2016 07:46:02 GMT</pubDate></item></channel></rss>