swamyonline
28th August 2008, 11:42
hi ppl,
in my application, im trying to receive broadcasted data on udp port. the code is as follows:
#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
}
}
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
in my application, im trying to receive broadcasted data on udp port. the code is as follows:
#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
}
}
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