Re: Socket thread problem
Quote:
Originally Posted by
waynew
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.
Then use asynchronous API, nothing will block then.
Re: Socket thread problem
I'm not sure how to do this Wysota. What would the structure look like? How can you be listening for the server response and still running the gui?
Re: Socket thread problem
You would connect to your socket's readyRead() signal or other signals appropriate to the situation, as the examples bundled with Qt show.
Re: Socket thread problem
Thanks Wysota - I think I see what you mean. I am going to restructure this way and see how it works.
I'm sure you will have some sage advice if I have problems :)