Yes, against the expert's advice, I am using a separate thread for QTcpSocket to send data to a server.
Here is why - it takes between 10 and 15 seconds to log into the server, receive a response, then send the data.
If a separate thread is not used, the gui is frozen during this time which is unacceptable.
The problem however is that when the data is sent to the server, and the send loop exited, and the signal sent back to the originating dialog to close, the slot in the dialog to close the operation never executes. So I am assuming the signal is never received. Using debug, I can see that the process is hung up in a looping nature having to do with mutex when the send loop in the thread is exited and the signal is sent. This is puzzling since there are no shared objects between this thread and the main thread.
I did read "you are doing it wrong". Does this imply that simply moving the networking code to a new class and calling it from the thread class will solve the problem? It doesn't seem like it. Yes, I did try setting the connection as queued. No difference.
Suggestions are welcome and thanks!
Bookmarks