Hi,
I'm trying to broadcast a datagram using QUdpSocket. Now I used example BroadcastSender from QT docs and it doesn't seem to work.
Socket returns "Unable to send a message" problem and datagram is not emited(checked with wireshark). It only occours when I try to broadcast to whole network (using QHostAddress:Broadcast or QHostAddress("255.255.255.255"). When I change first octet (for example on "192.255.255.255") it also works fine.
The deal is, that I want to broadcast message for all addresses assigned to the device, so I wanna use full broadcast.
I tested it only on windows simulator (S60 3rd and 5rd edition).
Here's my code:
udpSocket->writeDatagram(datagram.data(), datagram.size(),
statusLabel->setText(udpSocket->errorString());
++messageNo;
QByteArray datagram = "Broadcast message " + QByteArray::number(messageNo);
udpSocket->writeDatagram(datagram.data(), datagram.size(),
QHostAddress::Broadcast, 1111);
statusLabel->setText(udpSocket->errorString());
++messageNo;
To copy to clipboard, switch view to plain text mode
Any ideas, how to solve my problem?
Bookmarks