Does listen() method runs in another thread?



  • Does the listen method runs in a different thread or I have to create a new thread and call the listen method there?



  • @mandruk1331 listen() runs in the same thread as the object listen() belonges to. I you have for example a QTcpServer that listens for connections, listen runs in the same thread as your QTcpServer.

    That means once every Eventloop it will check for new connections and emit the signal, if there are any.

    So if you block your thread with a heavy duty operation your TcpServer will not react to new connections, during that operation.

    My advice, if you can, than run your server in a different thread.



  • @J.Hilk Thank you! That's what I wanted to know.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.