From c82d40749dc1ce816333e84d7f3232e59fbe2058 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 30 Mar 2012 16:23:24 +0200 Subject: Fix multicast join/leave when binding to QHostAddress::Any. On OS X and Windows, this was not working, because the socket was being bound in v6 mode (due to ::Any being for dual mode), but the address passed was a v4 address, meaning it took the wrong codepath. Linux, strangely, apparently works anyway. This is fixable in OS X (by using the v6 join path when bound in v6/dual mode), but the same fix doesn't work on Windows, failing with WSAEADDRNOTAVAIL. Don't allow this behaviour, and provide a sane error message telling the user what to do instead. Done-with: Shane Kearns Task-number: QTBUG-25047 Change-Id: Iaf5bbee82e13ac92e11b60c558f5af9ce26f474b Reviewed-by: Shane Kearns --- examples/network/multicastreceiver/receiver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/network/multicastreceiver/receiver.cpp b/examples/network/multicastreceiver/receiver.cpp index 6448817410..041812f56a 100644 --- a/examples/network/multicastreceiver/receiver.cpp +++ b/examples/network/multicastreceiver/receiver.cpp @@ -52,7 +52,7 @@ Receiver::Receiver(QWidget *parent) quitButton = new QPushButton(tr("&Quit")); udpSocket = new QUdpSocket(this); - udpSocket->bind(45454, QUdpSocket::ShareAddress); + udpSocket->bind(QHostAddress::AnyIPv4, 45454, QUdpSocket::ShareAddress); udpSocket->joinMulticastGroup(groupAddress); connect(udpSocket, SIGNAL(readyRead()), -- cgit v1.2.3