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. how to get Transfer rate when downloading file
Forum Updated to NodeBB v4.3 + New Features

how to get Transfer rate when downloading file

Scheduled Pinned Locked Moved Solved General and Desktop
qnetworkaccessmqnetworkreplytransfer rate
4 Posts 3 Posters 1.3k 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
    ARASHz4
    wrote on 12 May 2016, 14:03 last edited by
    #1

    Hi
    I want to get transfer rate when downloading a file
    in use QNetworkAccessManager , QNetworkReply

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 12 May 2016, 14:22 last edited by
      #2

      Use a QTimer to count the interval between two QNetworkReply::readyRead() signals then take QNetworkReply::bytesAvailable() divide by 8 times (1 byte=8bits) the timer value (in seconds) and then adjust for the magnitude ( divide by 1024 for kb, by 1048576 for Mbps or 1073741824 for Gbps)

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      T 1 Reply Last reply 12 May 2016, 14:38
      3
      • V VRonin
        12 May 2016, 14:22

        Use a QTimer to count the interval between two QNetworkReply::readyRead() signals then take QNetworkReply::bytesAvailable() divide by 8 times (1 byte=8bits) the timer value (in seconds) and then adjust for the magnitude ( divide by 1024 for kb, by 1048576 for Mbps or 1073741824 for Gbps)

        T Offline
        T Offline
        the_
        wrote on 12 May 2016, 14:38 last edited by
        #3

        @VRonin

        as 1 byte is 8 bits it should be 8times QNetworkReply::bytesAvailable() divided by the timver value to get bits/second iirc :)

        -- No support in PM --

        V 1 Reply Last reply 13 May 2016, 07:38
        2
        • T the_
          12 May 2016, 14:38

          @VRonin

          as 1 byte is 8 bits it should be 8times QNetworkReply::bytesAvailable() divided by the timver value to get bits/second iirc :)

          V Offline
          V Offline
          VRonin
          wrote on 13 May 2016, 07:38 last edited by
          #4

          @the_ I can't even math anymore. thanks for the correction

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          0

          1/4

          12 May 2016, 14:03

          • Login

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