OK, so i don't know exactly why but I got it working.
I believe that the following were the problems:
m_udpSocket->bind(QHostAddress::AnyIPv4, 4210)
**instead of**
udpSocket->bind(45454, QUdpSocket::ShareAddress); as mentioned in the broadcast receiver example
connect(m_udpSocket, &QUdpSocket::readyRead, this, &Receiver::processPendingDatagrams);
**instead of**
connect(m_udpSocket, SIGNAL(readyRead()), this, SLOT(ReceiveData()), Qt::QueuedConnection); what i used in my initial application when posting for help
while (m_udpSocket->hasPendingDatagrams()) {
datagram.resize(int(m_udpSocket->pendingDatagramSize()));
m_udpSocket->readDatagram(datagram.data(), datagram.size());
qDebug() << "Message: " << datagram.constData();
}
**instead of**
while (m_udpSocket->hasPendingDatagrams()) {
QByteArray datagram;
QHostAddress sender;
quint16 senderPort;
qDebug() << "2 ";
datagram.resize(m_udpSocket->pendingDatagramSize());
m_udpSocket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
qDebug() << "Message from: " << sender.toString();
qDebug() << "Message port: " << senderPort;
qDebug() << "Message: " << **datagram;**
//as per my initial program
}
Thank you all for all your involvement and support
Regards
Elian N.