Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved how to get Transfer rate when downloading file

    General and Desktop
    qnetworkaccessm qnetworkreply transfer rate
    3
    4
    1016
    Loading More Posts
    • 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
      ARASHz4 last edited by

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

      1 Reply Last reply Reply Quote 0
      • V
        VRonin last edited by

        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_ 1 Reply Last reply Reply Quote 3
        • the_
          the_ @VRonin last edited by

          @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 Reply Quote 2
          • V
            VRonin @the_ last edited by

            @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 Reply Quote 0
            • First post
              Last post