QTcpServer newConnection signal is not emitted, even after the connected signal is emitted on the clients QTcpSocket
-
Server:
m_server = new QTcpServer(this); connect( m_server, SIGNAL( newConnection() ), this, SLOT( client_connected() ) ); if (m_server->listen(QHostAddress::Any, 55556) == false) { logger.log("Server failed to listen to port 55556"); }Client:
m_socket = new QTcpSocket(); connect( m_socket, SIGNAL( connected() ), this , SLOT( connected_to_server() ) ); m_socket->connectToHost(address, 55556);The clients QTcpSocket connected SIGNAL gets emitted and connected_to_server gets called, but on the server side the SIGNAL newConnection does not get emitted!
Port is not used, firewall exception is active on both sides, event loop exists
-
Hi,
Are you running the client and server on the same machine ?
What version of Qt are you using ?
If using Qt 5, you should change your connection statement and use the new style using function pointers, that will give you compile errors in case you have an error in your methods name. -
Hi,
Are you running the client and server on the same machine ?
What version of Qt are you using ?
If using Qt 5, you should change your connection statement and use the new style using function pointers, that will give you compile errors in case you have an error in your methods name. -
That's not that. Please read the Signals & Slots chapter of Qt's documentation. However, as already stated, it's only valid for Qt 5.
Before going further, are you locked to that outdated version of Qt ? If so, can you at least update to Qt 4.8.7 which is the latest and last version of the Qt 4 series.
-
That's not that. Please read the Signals & Slots chapter of Qt's documentation. However, as already stated, it's only valid for Qt 5.
Before going further, are you locked to that outdated version of Qt ? If so, can you at least update to Qt 4.8.7 which is the latest and last version of the Qt 4 series.
-
Unless you are locked to the Qt 4 series, you should move to Qt 5.12.
-
Good !
Then please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)