Qt incomingConnections not being called
I have compiled a Qt Travel Planner Example which uses QTcpSocket
both QTcpServer
to create a client and a server.
The problem is the server slot is incomingConnection()
not being called. Although the client is successfully connecting to the server. Therefore, the socket signal is readyRead()
never emitted and no data is returned by the client.
tripserver.cpp
TripServer::TripServer(QObject *parent)
: QTcpServer(parent)
{
}
void TripServer::incomingConnection(int socketId)
{
qDebug() << "Incoming Connection";
ClientSocket *socket = new ClientSocket(this);
socket->setSocketDescriptor(socketId);
}
If I add a newConnection () slot, it gets called. So what's going on?
source to share
Found my answer.
The parameter list has changed since Qt 4.8.1
http://qt-project.org/doc/qt-5.0/qtnetwork/qtcpserver.html#incomingConnection
void TripServer::incomingConnection(qintptr socketId){}
source to share