sandor
22nd May 2012, 11:24
Some might have an idea what to do...
There are 3 QTcpServers listening or 3 different ports. I override incomingConnection or connect signal newConnection; those produce the same behavior. The problem is that the 3 servers must do a fair bit of work before sending a response and while one server processes the incoming connection, another thread cannot receive a connection since the main application message queue is blocked (I can create QThreads to process later but that still costs some speed).
So, how can I ensure that the 3 QTcpServer instances own their own message queue and work really independently and receive messages really independently too? I tried to make classes extending QThread, also tried moveToThread but I am getting the "QObject: Cannot create children for a parent that is in a different thread." error message when trying to do that (surprisingly setMaxPendingConnections works, no complaints from Qt, but when it comes to listen... then it does not work).
Any idea?
There are 3 QTcpServers listening or 3 different ports. I override incomingConnection or connect signal newConnection; those produce the same behavior. The problem is that the 3 servers must do a fair bit of work before sending a response and while one server processes the incoming connection, another thread cannot receive a connection since the main application message queue is blocked (I can create QThreads to process later but that still costs some speed).
So, how can I ensure that the 3 QTcpServer instances own their own message queue and work really independently and receive messages really independently too? I tried to make classes extending QThread, also tried moveToThread but I am getting the "QObject: Cannot create children for a parent that is in a different thread." error message when trying to do that (surprisingly setMaxPendingConnections works, no complaints from Qt, but when it comes to listen... then it does not work).
Any idea?