QNetworkAccessManager number of requests limitation (interested in qt 4.8)
2beers last edited by
Hi everyone. I'm interested to know if there are some limitations in the number of requests in QNetworkAccessManager. Interested in the situation of qt 4.8.
The reason why I'm asking this is because in this "post":http://labs.qt.nokia.com/2011/04/29/threaded-http-inside-qnetworkaccessmanager/ : on comment #4 Markus Goetz said something like this:
The design philosophy is that you can pump in as many requests as you want and QNetworkAccessManager will limit its sockets to a internet friendly value (currently 6 per host:port on desktop machines, less on mobile).
My application will require to make much more than 6 simultaneous requests , so I need to know if I understand correctly or is relating something else. If max requests is 6, how can I overwrite this?
I forgot to tell, I'm not using any webkit in my application.
raulgd last edited by
You actually have to handle your own requests queue and your own connection strategy. That means that for each thread, you will be able to handle at most 6 requests per connection, and even that, because it's designed for a thread per connection strategy, it's not even worth it to have send 6 simultaneous requests per access manager.
So it doesn't limit your app to 6 simultaneous requests, it just limits it to 6 simultaneous requests per access manager, so if you need, let's say, 18 requests, you just create 3 threads with a QNetworkAccessManager object in each thread, and send 6 requests in each, but I wouldn't recommend that unless you really know how QNetworkAccessManager behaves, if you don't just use a thread per request and you are limited by your computer's ability to handle threads, or if you want to optimize, create a thread pool, where you queue requests, and as soon as one thread is done with a request, instead of destroying it, assign it another request from the queue (if you have database experience, it's like a database connection pool but for HTTP requests).
2beers last edited by
oh. thanks raul. It won't be more than 1 simultaneous request for every QNetworkAccessManager object.
I thought that is was limited to 6 simultaneous requests/application .