I am working with a piece of custom hardware (black box) that is sending UDP packets of data. Looking at the packets in Wireshark I can see that the hardware has the source IP set to 192.168.1.128 on port 4096 and the destination IP set to 0.0.0.0 on port 8192.
I am running a small Qt application on a Windows 7 machine that opens a UDP listener on port 8192 and should display packet data when it is received but, it never receives a packet. At this point I don't care what the data looks like I just want to verfiy that I can receive UDP from the external hardware.
Is this an operating system issue such that Windows will not receive a packet with destination set to 0.0.0.0? Should I use winpcap lib?
Any insight is most appreciated.
I have included an example of the UDP listener code.
ui.setupUi(this);
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
udpSocket->bind(8192);
setWindowTitle(tr("Display"));
}
void SeekerGui::processPendingDatagrams()
{
while (udpSocket->hasPendingDatagrams())
{
datagram.resize(udpSocket->pendingDatagramSize());
udpSocket->readDatagram(datagram.data(), datagram.size());
ui.lineEdit_test->setText(tr("Received datagram: \"%1\"").arg(datagram.data()));
}
}
Gui::Gui(QWidget *parent)
: QMainWindow(parent){
ui.setupUi(this);
udpSocket = new QUdpSocket(this);
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
udpSocket->bind(8192);
setWindowTitle(tr("Display"));
}
void SeekerGui::processPendingDatagrams()
{
while (udpSocket->hasPendingDatagrams())
{
QByteArray datagram;
datagram.resize(udpSocket->pendingDatagramSize());
udpSocket->readDatagram(datagram.data(), datagram.size());
ui.lineEdit_test->setText(tr("Received datagram: \"%1\"").arg(datagram.data()));
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks