View Full Version : Multiple threads with one QTcpSocket

23rd January 2010, 17:37

From what I gather from the docs, one cannot set the same socket descriptor across multiple QTcpSockets in different threads.

Is there a way around this if one just wants to have one thread read while the other writes?


23rd January 2010, 19:53
Why would you want that (and no, there is no way to do it the Qt way)?

23rd January 2010, 21:20
Thanks for the reply. I have a write thread that needs to block on a message queue, processes the queue data, then write it out to the socket. I have another thread who's responsibilities is to read data from the socket and generate events. I thought it would just be simplier to have the two threads doing their own thing. I guess I will have to just have one thread which then waits for signals on socket data received and an insertion into the queue.