Dear QT developers
I am a kind of newbie for QT. Since sometime I developed a code/ui that communicates with some I/O devices through a UDP protocol. So I am able to communicate but the problem is that the UDP packet should be sent through a specific port because the IO device is checking the source port and the source address of the coming packet I guess through the header.
I tried all the solutions around (binding first) but whatever I tried it didn't worked as I see with wireshark. Any help is much appreciated because I need it urgently.
I attach a piece of code that I am using to send.
void MainWindow
::Sender(QByteArray blockOfData, quint16 port
) {
QString address
= ui
->baseAddressTF
->text
();
qDebug() << "Send + Receive";
socket
->writeDatagram
(blockOfData,
QHostAddress(address
), port
);
qDebug() << socket->errorString();
}
void MainWindow::Sender(QByteArray blockOfData, quint16 port)
{
QString address = ui->baseAddressTF->text();
qDebug() << "Send + Receive";
socket = new QUdpSocket( this );
socket->bind(QHostAddress("127.0.0.1"), 6007);
socket->writeDatagram(blockOfData,QHostAddress(address), port);
qDebug() << socket->errorString();
}
To copy to clipboard, switch view to plain text mode
Many Many thanks in advance
And to be more specific I want to send a packet to ip:10.0.0.2, port 6263 but through port 6007 and now I can't really seeing through wireshark that the source port is always a random port.
Thanks again
Bookmarks