hi ppl,
in my application, im trying to receive broadcasted data on udp port. the code is as follows:
#include <QUdpSocket>
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(updateData()));
udpSocket
->bind
(2345,
QUdpSocket::DefaultForPlatform);
// udpSocket->bind(QHostAddress::LocalHost,2345) //*** I also tried this option ****//
void MyClass::updateData()
{
while(udpSocket->hasPendingDatagrams())
{
bytesRead = udpSocket->readDatagram((char *)charBuf.tData, sizeof(charBuf.tBuf));
// process the data
}
}
#include <QUdpSocket>
QUdpSocket *udpSocket;
udpSocket = new QUdpSocket(this);
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(updateData()));
udpSocket->bind(2345,QUdpSocket::DefaultForPlatform);
// udpSocket->bind(QHostAddress::LocalHost,2345) //*** I also tried this option ****//
void MyClass::updateData()
{
while(udpSocket->hasPendingDatagrams())
{
bytesRead = udpSocket->readDatagram((char *)charBuf.tData, sizeof(charBuf.tBuf));
// process the data
}
}
To copy to clipboard, switch view to plain text mode
i successfully, compiled the code and my application is running perfectly. im receiving data on port 2345. but once i terminate the application, im getting this message in the console.
QNativeSocketEngine::bind() was not called in QAbstractSocket::UnconnectedState
what does this mean? the application is running perfectly, but im not understanding the msg given there. thanks in advance for ur suggestions.
bye
Bookmarks