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. Qt- resuming http download and resending http request
Forum Updated to NodeBB v4.3 + New Features

Qt- resuming http download and resending http request

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k 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.
  • R Offline
    R Offline
    redstoneleo
    wrote on last edited by
    #1

    first ,I paused the downloading process without closing my application ,a few minutes later ,if I want to resume the download again ,do I have to send a second request to the sever ?

    as far as I know ,the http connection will keep alive for a while after the downloading process is paused , so there is no need to resend a request to the sever again ,right ?

    In Qt, how can we pause the downloading process? which method should we use ? QNetworkReply::close() or QNetworkReply::abort() or other ways ?

    if the http connection still keeps alive, is it possible to resume the http download without resending http request to the sever ? It would be better to show me some code on implementing this ,thanks.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Http is a stateless protocol. You're either receiving data or not and there is no pausing. This effect can be simulated though.
      First of all server needs to support few things. It must send the size of resource as one of the response headers and it needs to support range headers in requests. Most servers do.

      To "pause" you should just call abort(), as close() just closes the IODevice and doesn't actually stop the transfer. You should also store somewhere the size of the resource from the response header and the size of the data you already downloaded.
      To "resume" you make another request using the "range http header":http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 with a range corresponding to the remaining part.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        redstoneleo
        wrote on last edited by
        #3

        [quote author="Chris Kawa" date="1384685415"]Http is a stateless protocol. You're either receiving data or not and there is no pausing. This effect can be simulated though.
        First of all server needs to support few things. It must send the size of resource as one of the response headers and it needs to support range headers in requests. Most servers do.

        To "pause" you should just call abort(), as close() just closes the IODevice and doesn't actually stop the transfer. You should also store somewhere the size of the resource from the response header and the size of the data you already downloaded.
        To "resume" you make another request using the "range http header":http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 with a range corresponding to the remaining part.[/quote]
        http://qt-project.org/forums/viewthread/35211/

        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