how to get Transfer rate when downloading file
-
wrote on 12 May 2016, 14:03 last edited by
Hi
I want to get transfer rate when downloading a file
in use QNetworkAccessManager , QNetworkReply -
wrote on 12 May 2016, 14:22 last edited by
Use a QTimer to count the interval between two
QNetworkReply::readyRead()
signals then takeQNetworkReply::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) -
Use a QTimer to count the interval between two
QNetworkReply::readyRead()
signals then takeQNetworkReply::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) -
as 1 byte is 8 bits it should be 8times
QNetworkReply::bytesAvailable()
divided by the timver value to get bits/second iirc :)
1/4