PDA

View Full Version : QNetworkReply and multiple files download



Annihilator
3rd April 2012, 22:15
I use QNetworkReply. I want to download multiple files simultaneously. I'm gonna use readyRead signal for reading data of each file. The problem is that I don't know for which of files data amount is ready at the moment. What is the best solution for downloading multiple files chunk by chunk.

wysota
3rd April 2012, 22:54
Each QNetworkReply object corresponds to one request (and thus one file).

Lykurg
4th April 2012, 00:25
...use QSignalMapper to identify which replay has sent the signal.

Annihilator
4th April 2012, 16:42
Each QNetworkReply object corresponds to one request (and thus one file).
That is why I'm asking. Can you get file name from slot binded to readyRead?


...use QSignalMapper to identify which replay has sent the signal.

Thanks! That is what I was looking for!

wysota
4th April 2012, 17:08
Can you get file name from slot binded to readyRead?
No. The reply doesn't have to be associated with any file. It's just a stream of bytes and it's just you who is interpreting this stream as a file. If the server reports the file name, then it does that most likely as a header in the reply.