I have a multithreaded server.
QTcpSocket must be created in the stream in which it should be run, FI: Qt - process QTcpSocket in a new stream , passing the socket descriptor.
My problem is that I need to have a pool of threads and move the socket along a specific thread AFTER the client has sent a specific token that determines which thread the socket should be in.
In other words, I need to read the socket to find out on which stream it will be placed in advance.
Some idea would be to first bind a QTcpSocket, read, then send the handle to the stream and create another QTcpSocket, but the document says:
Note. It is not possible to initialize two abstract sockets using the same native socket descriptor.
Another solution is to create a socket in a separate thread and then combine both threads together, although I don't know if this is possible.
Or maybe you can read the socket descriptor in the main thread before calling setSocketDescriptor in the child stream, if possible?
source share