Question about QTcpSocket and QThread
-
Because the QTcpSocket is reentrant you only need to take good care of how to handle the data send or received from the socket. If more then 1 thread uses the same data you will not be able to use the QList etc to handle this because that class is not thread safe. You might have to look into QMutex class to handle data acces between threads.
Hope this give a bit of direction. Have fun coding!! -
You have to keep track which thread will close the socket since only the creator-thread of a socket is allowed to close a socket.
A safer way would be to distribute only the socket descriptor and have each thread its own QTcpSocket that uses setSocketDescriptor to use the communication peer.