QUdpSocket - don't receive data
-
Hello,
I would like to send data from Linux Qt App to Windows Qt App and next when windows app receive data I want to send data from windows app to linux app.
I can send data from linux to windows - I see the message, but my linux app don't receive data from windows.
Windows: 192.168.0.73
Linux: 192.168.0.122Codes:
Windows:socket = new QUdpSocket; socket->bind(QHostAddress::Any,7212); socket2 = new QUdpSocket; connect(socket, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); And in readyReadSlot(): QByteArray b; b.resize(socket->pendingDatagramSize()); QHostAddress host; quint16 port; socket->readDatagram(b.data(),b.size(),&host,&port); … QByteArray byte; byte.append("nooo!!!"); qDebug()<<socket2->writeDatagram(byte.data(),byte.count(),QHostAddress("192.168.0.122"),7213);
Linux code:
socket = new QUdpSocket; socket2 = new QUdpSocket; socket2->bind(QHostAddress::Any,7213); connect(socket2, SIGNAL(readyRead()),this,SLOT(readyReadSlot())); In clicked() slot: QByteArray byte; byte.append("abc"); socket->writeDatagram(byte, byte.count(), QHostAddress("192.168.0.73"), 7212); In readReadSlot: void MainWindow::readyReadSlot() { qqDebug()<<"something"; QByteArray byte; byte.resize(socket2->pendingDatagramSize()); socket2->readDatagram(byte.data(),byte.size()); qInfo()<<byte.data(); }
qDebug() in windows says: 7, so this is correct numer of send bytes. In linux I don't see qDebug() "something" and message.
-
Hi,
Are you sure the Windows firewall does not block that port coming inside ?
-
From a quick check of the tcpdump man page, it's the port number used to connect to your machine.
-
That's the target port of the remote machine not the one used by the source machine.