Search code examples
multithreadingqtthread-safetyqtcpserver

How to use a QTCPServer in multiple threads?


I am trying to write a webserver that processes requests from multiple clients simultaneously. The way it is designed, only one request can be processed at a time.

What I need is a way to call nextPendingConnection() and then dispatch the connection to a separate thread for processing.

Is there any way to do this?


Solution

  • This sample here should explain it http://doc.qt.io/qt-5/qtnetwork-threadedfortuneserver-example.html