PDA

View Full Version : QNetworkAccessManager - how to enable more than 6 connections



code_err
28th December 2015, 10:43
Hello, I'm trying to cooperate with very busy web server. I send get and post requests to it and wait few seconds for response. If there is no response I'm doing what I would do in a web browser - send request again. I think that this is an equivalent to refreshing page. But there is a problem. In HttpAnalyzerStdV7 I can see http requests and responds. It looks like QNetworkAccessManager let me sends only 6 requests at once and only when server responds after about 120 seconds with 504 - http timeout code I can send a new one. How can I abandon old request? I thought that deleting QNetworkReply would be enough but it doesn't work. Any suggestions?

yeye_olive
28th December 2015, 19:38
It looks like QNetworkAccessManager let me sends only 6 requests at once and only when server responds after about 120 seconds with 504 - http timeout code I can send a new one.
Indeed, as stated in the documentation for QNetworkAccessManager:
Currently, for the HTTP protocol on desktop platforms, 6 requests are executed in parallel for one host/port combination.

How can I abandon old request? I thought that deleting QNetworkReply would be enough but it doesn't work. Any suggestions?
You could try QNetworkReply::abort(), but I suspect it will not improve over the destructor; both apparently close the network connection. Does your HttpAnalyzerStdV7 show the connections being closed?

anda_skoa
29th December 2015, 10:25
close and abort do different things, see the documentation for QNetworkReply::close().

Cheers,
_

code_err
29th December 2015, 11:33
Thank You. I didn't see abort and close. It can be useful. HttpAnalyzerStdV7 shows only requests and responds. After 120s server responds with 504 code and then connection is shown by HttpAnalyzerStdV7 as closed.