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. Limit QNetworkAccessManager download speed
Forum Updated to NodeBB v4.3 + New Features

Limit QNetworkAccessManager download speed

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.5k Views 2 Watching
  • 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.
  • M Offline
    M Offline
    Mr Gisa
    wrote on last edited by
    #1

    Is it possible to control the QNetworkAccessManager download speed and how?

    1 Reply Last reply
    1
    • KillerSmathK Offline
      KillerSmathK Offline
      KillerSmath
      wrote on last edited by
      #2

      Have you tried to use setReadBufferSize function of QNetworkReply?

      http://doc.qt.io/qt-5/qnetworkreply.html#setReadBufferSize

      QNetworkReply will try to stop reading from the network once this buffer is full (i.e., bytesAvailable() returns size or more), thus causing the download to throttle down as well. If the buffer is not limited in size, QNetworkReply will try to download as fast as possible from the network.

      @Computer Science Student - Brazil
      Web Developer and Researcher
      “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

      1 Reply Last reply
      3
      • M Offline
        M Offline
        Mr Gisa
        wrote on last edited by
        #3

        Thank you very much.
        I haven't tested yet but I know it was a bugged before in earlier versions, let's see if it's solved.

        Muito obrigado, eu já pesquisei sobre isso antes e sei que estava com um problema, mas não sei se já resolveram, no entanto irei testar para ver.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          wrosecrans
          wrote on last edited by
          #4

          You can't directly control how quickly the other end of the connection sends you packets. So there's no definite way with TCP to limit a connection's bandwidth usage to guarantee that it doesn't fill up a link.

          But, assuming the other end is reasonably well behaved, it will only send packets once it gets an acknowledgement from your system. So, cranking down the read buffer size, like KillerSmath mentioned will help because once all the buffers get full, your machine will stop sending acknowledgements of new packets, forcing the sending side to stop sending so quickly. Another thing you can do is to only read the incoming data at your set rate. This will help guarantee that your buffers get full and packets start getting dropped, throttling the connection.

          So, oddly, the best way to get the sending side to only send at a certain rate, is to only read at that rate. Everything will basically sort itself out from there.

          1 Reply Last reply
          2

          • Login

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