calling start() on a QThread multiple times.
-
Hi!
I'm developing a NNTP Client which uses multiple connections to retrieve Headers and Articles from the Server. My idea was to provide the Networking-Object, which is a subclass of QThread Object, with all the necessary informations and do the connection/reading in a thread, works fine if I call this Object once - like retrieving the Groups that are available on that server.
The Problems start when I have to call this object multiple times..:
1.) send "HEAD <articlenumber>" => got response from Server
1a.) Parse Article's header
2.) send "HEAD <next articlenumber>" => nothing as a responseMy logging says that the Object is sending the next request, but it never seems to can get any answer from the server, like the connection has dropped (which it hasn't).
https://pastebin.com/fWA83MCn
That's the source from the NNTP-Networking-Object.Thanks in advance!
-
Because there could be up to 100 concurrent connections to the server (depending on what your provider configured), which results in very slow queries if I do all the work in the Mainthread - and yes I tried that approach first with only 20 concurrent connections.
I also did take a look at how other NNTP Clients, like nzbget, handles the connections/request/response and they did it with threads too.
-
Okay this is solved, I found a posting (https://stackoverflow.com/questions/38217728/move-qtcpsocket-to-a-new-thread-after-the-connection-is-initiated) with detailed instructions how to do this. I used movetothread() and called the readyRead-slot again and everything is fine.