In the app I'm writing I need to limit download speed. I'm using QHttp. Can I do that ?
In the app I'm writing I need to limit download speed. I'm using QHttp. Can I do that ?
C++ & AMD forever
You can implement tcp socket with rate control like in this article and then replace the internal socket of QHttp using:
Qt Code:
To copy to clipboard, switch view to plain text mode
Last edited by danadam; 15th November 2007 at 19:23. Reason: updated contents
The Wheel weaves as the Wheel wills.
I've tried sources from the example . But I didn't get QHttp::authenticationRequired signal from my QHttp object![]()
The resopnse header was "HTTP/1.0 401 Unauthorized"
Anybody knows how to fix the problem ?
C++ & AMD forever
Never mind. I've fixed this problem
But now I have a new problem
The use of CPU on my machine is about 50 percent ! And the use of memory is constantly growing![]()
C++ & AMD forever
Do you have any "busy wait" loops in your code? Or timers with short timeouts?
You might have a memory leak. You can use valgrind find it, but I'm not sure how usable it is under Mac OS. There might be some similar tools for windows, but unfortunately I don't know any of them.
You can also look for leaks yourself by checking whether you delete all objects created using new operator. Remember that Qt will delete QObjects only when you delete their parent.
Has anyone tried to compile and run source code from the article ? I've tried it both on MacOS and Windows but result is the same - half CPU time and constant memory growth
I've tried to use this source like this:
Qt Code:
int main(int argc, char **argv) { RcTcpSocket socket; QHttp http; http.setSocket(&socket); http.setHost(url.host()); http.get(url.path(), &file); RateController controller; controller.setUploadLimit(512); controller.setDownloadLimit(2048); controller.addSocket(&socket); return app.exec(); }To copy to clipboard, switch view to plain text mode
C++ & AMD forever
Bookmarks