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

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
  • 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 last edited by
    #1

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

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on 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

      the_T 1 Reply Last reply
      3
      • VRoninV VRonin

        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)

        the_T Offline
        the_T Offline
        the_
        wrote on 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 --

        VRoninV 1 Reply Last reply
        2
        • the_T the_

          @VRonin

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

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on 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

          • Login

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