Important: Please read the Qt Code of Conduct -

QTcpServer listen() problem

  • I have a problem with NokiaQtSDK which has QT 4.63. The test device is Nokia E7.
    The QTcpServer listen() doesn't really seem to work as expected.

    I start my Network connections manually before starting the app.
    So QNetworkInterface::allAddresses() returns two IP addresses:

    "" (WLAN)
    "" (AP)

    Then I start to listen:

    QTcpServer serv1, serv2;
    serv1.listen(QHostAddress(""), 80); //WLAN return true
    serv2.listen(QHostAddress(""), 80); //AP return true
    serv1.isListening(); //WLAN return true
    serv2.isListening(); //AP return true

    However only one is truely listening. This seems to depend on which of theese two comes first in the:

    Connectivity->Settings->Network Destinations->Internet list.

    When I set WLAN first WLAN listens, when I set AP first AP listens. Tested both with web browser to see if port is open and with "nmap -sT" which always reports one port listening and the other being closed.

    I get the same result if I only do listen(QHostAddress::Any);

    Any way I can fix this?


    EDIT: please use @-tags to enable code highighting, Gerolf

    thanks, didn't know this!

Log in to reply