Question about QTcpSocket and QThread
When I trying to use a QTcpSocket in a multithread enviroment, what should I pay attention to? As I saw, the QTcpSocket is not thread-safe.
2 replies
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 must log in to post a reply. Not a member yet? Register here!
