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

Disable delay in QAbstractSocket::waitForConnected



  • I need to disable connection delay in socket. Now If I enter wrong address, I should be waiting for 1 minute before error signal will emitted.
    Also I'm trying make so:

    client_socket->connectToHost(ip, port);
        if (client_socket->waitForConnected(-1))
            qDebug("Connected!");
    

    but application is not responding after running.
    I use OS X 10.11.1 and Qt 5.5.0


  • Lifetime Qt Champion

    Hi,

    The current timeout is 30 seconds. Since you are setting -1 the function will not timeout so your are blocking your application.


Log in to reply