Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTCpSocket connection



  • I wrote program in QT ,for connect between server and client when I run program of server side and if server listen first then run the program of client side and client does connecting, The connection is established , but inverse (first run the program of client side)Connection is not established, how can fix this??



  • a Client can only connect to an existing server. What you could do is connect a slot to the error(QAbstractSocket::SocketError) signal in the client and if the error is QAbstractSocket::ConnectionRefusedError start a QTimer::Singleshot that will try and call connectToHost after a few seconds



  • tnx,it's helpful


Log in to reply