[Qt-interest] QUdpSocket's writeDatagram source port
Valentin Iliu
valentiniliu at yahoo.com
Wed Oct 28 13:31:30 CET 2009
I found the solution:
udpSocket = new QUdpSocket;
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(testCallback()));
udpSocket->bind();
udpSocket->writeDatagram(datagrams,QHostAddress(host),port);
localPort = udpSocket->getLocalPort(); // my getter
udpSocket->bind(localPort);
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(realCallback()));
udpSocket->writeDatagram(datagrams,QHostAddress(host),port);
And in the testCallback I call my setter:
setLocalPort(udpSocket->localPort());
and this time my friends, localPort() does return the port I'm looking for.
Thank you Markus and everyone else.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091028/4763d4ec/attachment.html
More information about the Qt-interest-old
mailing list