PDA

View Full Version : QNetworkAccessManager: only 6 requests are executed in parallel for one host



javimoya
4th January 2011, 21:46
QNetworkAccessManager:


Note: QNetworkAccessManager queues the requests it receives. The number of requests executed in parallel is dependent on the protocol. Currently, for the HTTP protocol on desktop platforms, 6 requests are executed in parallel for one host/port combination.

is there any way to increase that number?
I want to create a Download Manager app... and , because of multipart download, I need more requests in parallel for one host.

is a good idea to have a pool of QNetworkAccessManager objects in my app and balance the requests among them?
QT Documentation says this:

One QNetworkAccessManager should be enough for the whole Qt application.

can I modify Qt source code to increase that number? where?? what are the drawbacks of doing that?
in qhttpnetworkconnection.cpp is this:

#ifdef Q_OS_SYMBIAN
const int QHttpNetworkConnectionPrivate::defaultChannelCount = 3;
#else
const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6;
#endif

// The pipeline length. So there will be 4 requests in flight.
const int QHttpNetworkConnectionPrivate::defaultPipelineLeng th = 3;
// Only re-fill the pipeline if there's defaultRePipelineLength slots free in the pipeline.
// This means that there are 2 requests in flight and 2 slots free that will be re-filled.
const int QHttpNetworkConnectionPrivate::defaultRePipelineLe ngth = 2;



any other idea?

thank you

Farris
5th January 2011, 13:29
You can use multiple qnetworkaccessmanagers.

I have a quite large application that during 'peak' needs quite a few concurrent connections in various threads, so i put a qnam in each thread(each thread manages up to 6 connections). It works.

If you are connecting to different hosts/ports this limitation does not apply btw. Its per host:port .

javimoya
5th January 2011, 15:37
Thanks...

but...
why do you need threads?? qnam is already asyncronous...

Farris
6th January 2011, 11:05
I need threads for different reasons(various cpu or io intensive tasks), but it works out well since it makes it possible to use quite a few extra concurrent connections.

Coolcat
19th January 2011, 13:49
Tried HTTP-pipelining? Using pipelining QNetworkAccessManager does put multiple requests in a single packet.


request.setAttribute(QNetworkRequest::HttpPipelini ngAllowedAttribute, true);