PDA

View Full Version : Multiple threads with one QTcpSocket



xenome
23rd January 2010, 16:37
Hi,

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?

Thanks.

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

xenome
23rd January 2010, 20: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.