Qt Forum

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

    [Solved] Request speed in QNAM

    General and Desktop
    2
    3
    734
    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
      ashishbansal last edited by

      Hi everyone,
      I want to know the speed of the HTTP get request made to some link using QNetworkAccessManager.
      I have checked QNetworkReply api and was not able to find such function.
      But what I found is this [1] but there is not mention anywhere after how much time, this signal will be emitted. So that I would be able to know the download speed.
      Does anybody knows this time?
      Or any other better solution to get download speed.
      [1] http://doc.qt.io/qt-5/qnetworkreply.html#downloadProgress

      Thanks,
      Ashish Bansal

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        pownloadProgress is not emitted at constant intervals.
        Use "QElapsedTimer":http://doc.qt.io/qt-5/qelapsedtimer.html. Start it when you make the request and use "restart":http://doc.qt.io/qt-5/qelapsedtimer.html#restart in the downloadProgress handler to obtain amount of time passed between these signals. Speed is then the amount of data (obtained from bytesReceived parameter of the downloadProgress) divided by the time from the timer. Make sure to get the units right.

        1 Reply Last reply Reply Quote 0
        • A
          ashishbansal last edited by

          [quote author="Chris Kawa" date="1419793610"]pownloadProgress is not emitted at constant intervals.
          Use "QElapsedTimer":http://doc.qt.io/qt-5/qelapsedtimer.html. Start it when you make the request and use "restart":http://doc.qt.io/qt-5/qelapsedtimer.html#restart in the downloadProgress handler to obtain amount of time passed between these signals. Speed is then the amount of data (obtained from bytesReceived parameter of the downloadProgress) divided by the time from the timer. Make sure to get the units right.[/quote]

          Thanks Chris!!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post