Robert Wood
2014-06-23 12:03:03 UTC
Folks,
I've managed to get a simple program going that sends out a UDP packet
to a broadcast address (an Artnet Poll packet) and my embedded software
is receiving this and sending out a Poll reply. Wireshark confirms that
my embedded device is sending out the correct response, however, my Qt
program is not picking up any reply at all. I should say, this is the
first time I've used Qt for networking and it's my first embedded
netowrking project, so I may be missing some very basic point.
I am doing this in MainWindow initialisation:
udpSocSend = new QUdpSocket(this);
udpSocRec = new QUdpSocket(this);
udpSocSend->bind(QHostAddress("192.168.0.18"),6454);
udpSocRec->bind(6454, QUdpSocket::ShareAddress);
connect(udpSocRec, SIGNAL(readyRead()),this,
SLOT(processPendingDatagrams()));
void MainWindow::processPendingDatagrams()
{
while (udpSocRec->hasPendingDatagrams())
{
QByteArray datagram;
datagram.resize(udpSocRec->pendingDatagramSize());
udpSocRec->readDatagram(datagram.data(), datagram.size());
ui->textEdit->setText(tr("Received datagram:
\"%1\"").arg(datagram.data()));
}
}
My udpSocSend is working to send data out (an Artnet Poll), my STM32
(embedded micro) is sending packets back according to Wireshark, but
processPendingDatagrams() flatly refuses to be called!
Wireshark shows this in terms of a reply:
2475 795.416268000 192.168.0.177 192.168.0.18 ARTNET 282 ArtPollReply
(0x2100)
The STM32 is at address 192.168.0.177, my [Linux] Qt machine is
192.168.0.18.
The data in the datagram looks OK mto me on Wireshark.
Can anyone see anything I am doing wrong please?
Thanks!
Rob
I've managed to get a simple program going that sends out a UDP packet
to a broadcast address (an Artnet Poll packet) and my embedded software
is receiving this and sending out a Poll reply. Wireshark confirms that
my embedded device is sending out the correct response, however, my Qt
program is not picking up any reply at all. I should say, this is the
first time I've used Qt for networking and it's my first embedded
netowrking project, so I may be missing some very basic point.
I am doing this in MainWindow initialisation:
udpSocSend = new QUdpSocket(this);
udpSocRec = new QUdpSocket(this);
udpSocSend->bind(QHostAddress("192.168.0.18"),6454);
udpSocRec->bind(6454, QUdpSocket::ShareAddress);
connect(udpSocRec, SIGNAL(readyRead()),this,
SLOT(processPendingDatagrams()));
void MainWindow::processPendingDatagrams()
{
while (udpSocRec->hasPendingDatagrams())
{
QByteArray datagram;
datagram.resize(udpSocRec->pendingDatagramSize());
udpSocRec->readDatagram(datagram.data(), datagram.size());
ui->textEdit->setText(tr("Received datagram:
\"%1\"").arg(datagram.data()));
}
}
My udpSocSend is working to send data out (an Artnet Poll), my STM32
(embedded micro) is sending packets back according to Wireshark, but
processPendingDatagrams() flatly refuses to be called!
Wireshark shows this in terms of a reply:
2475 795.416268000 192.168.0.177 192.168.0.18 ARTNET 282 ArtPollReply
(0x2100)
The STM32 is at address 192.168.0.177, my [Linux] Qt machine is
192.168.0.18.
The data in the datagram looks OK mto me on Wireshark.
Can anyone see anything I am doing wrong please?
Thanks!
Rob