how to get Transfer rate when downloading file

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

  • Qt Champions 2018

    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)

  • @VRonin

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

  • Qt Champions 2018

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

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.