Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Crash in QNetworkManager when used in secondary thread [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

Crash in QNetworkManager when used in secondary thread [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
16 Posts 3 Posters 7.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #5

    Sir, is it possible to create a multi-segment downloader using QNetwork,

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #6

      What's a "multi-segment downloader"?

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        adnan
        wrote on last edited by
        #7

        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.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #8

          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.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #9

            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.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • A Offline
              A Offline
              adnan
              wrote on last edited by
              #10

              Sir, can you plz help me with creating such type of a header. A simple illustrative example would be highly appreciated.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #11

                "QNetworkRequest::setRawHeader() ":/doc/qt-4.8/qnetworkrequest.html#setRawHeader should get you further.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  adnan
                  wrote on last edited by
                  #12

                  Thanks Sir, it worked but still a problem.
                  Suppose the file size is 1256498 bytes

                  request.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

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #13

                    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");
                    @

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      adnan
                      wrote on last edited by
                      #14

                      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.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        adnan
                        wrote on last edited by
                        #15

                        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.zip

                        there 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

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          adnan
                          wrote on last edited by
                          #16

                          Anybody plz reply

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved