Crash in QNetworkManager when used in secondary thread [SOLVED]
-
Sir, is it possible to create a multi-segment downloader using QNetwork,
-
What's a "multi-segment downloader"?
-
Sir, suppose i wish to download a file. so i will simply do:
QNetworkManager manager.get(request(url))Both HTTP and FTP protocols allow the client to specify the start position of the stream. So can QNetworkRequest object be made to generate such a request where we can specify the starting position of the the stream, and if we can, then we can use manager.get(request(url)) multiple times (perhaps upto 6 times as mentioned in qt-doc) to download the the same file at different positions thereby accelerating the download.
-
Do people still actually use such crappy software such as download "managers" or "accelerators". First of all, I think it is anti-social behaviour to use them to accelerate your downloads. If the server is imposing a limit on the bandwidth to be allocated for a single connection, it does so for a reason. Why do you think you deserve more bandwidth than anyone else?
Using them to resume your downloads because you are on an unstable connection is a different discussion.Anyway, AFAIK, this part of the HTTP protocol is not supported by QNAM.
-
You can always send your custom headers with the QNetworkRequst. It should be possible to indicate a starting position for a transfer. It's up to you to assemble the different bits and bytes in the correct order to the final file, though.
-
Sir, can you plz help me with creating such type of a header. A simple illustrative example would be highly appreciated.
-
"QNetworkRequest::setRawHeader() ":/doc/qt-4.8/qnetworkrequest.html#setRawHeader should get you further.
-
Thanks Sir, it worked but still a problem.
Suppose the file size is 1256498 bytesrequest.setRawHeader("Range: bytes=0-1256498",""); //downloads the whole file as expected
request.setRawHeader("Range: bytes=0-12564",""); //downloads 12565 bytes as expected
request.setRawHeader("Range: bytes=5-13339077",""); //downloads 394 bytes for any byte range not starting with zero
-
If you do that on the very same url, how should that work?
If the file has a size of 1256498, as you state in in the first version "downloads the whole file", then a range of 13339077 clearly exceeds the limits (it's more than 10 times bigger).
Did you look at the 394 bytes in the third answer? Could be that it contains an error message?
BTW: The correct usage of setRawHeader is:
@
req.setRawHeader("Range", "bytes=12-155");
@ -
Sir, actually i had made a mistake in the question in the third case, it was obviously less than the file size.
And the problem was with the syntax as you stated and it is now working, even on the same url. Thanks again and thanks again for always replying to my queries. -
My downloader is working fine and i am testing it right now on many sites. Surprisingly it couldn't download any file from furk.net.
I tried a simple program using networkaccessmanager it still failed i.e. no problem with my downloader. I tried downloading using other downloaders:
fatrat: also developed using qt (it also failed)
uget: successfully started download
firefox in-built: successful
I doubt there is some problem in parsing the url. I am pasting the url but it is expired:
http://g9uau0ao42n1kortjknotrql05sr45pbh4uq8s8.gcdn.biz/d/r/Y4APk1wSRw6QCiOdWl1tKD-hKUKyDHCYn5rsDoRf9gPxJkYidwuSQSDO6xBEBEwDZ0ZGZl0iWW384kTVqcNOBw/black Stone V3 - 6.zipthere are no spaces at end actually "percent20" which were replaced by spaces by this editor
Perhaps such long urls or "percent20" are not supported by qurl/qstring. plz help -
Anybody plz reply