[Interest] QNAM timeout is way too long

Scott Aron Bloom scott.bloom at onshorecs.com
Mon Apr 21 20:55:28 CEST 2014


-----Original Message-----
From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of Thiago Macieira
Sent: Monday, April 21, 2014 10:32 AM
To: interest at qt-project.org
Subject: Re: [Interest] QNAM timeout is way too long

Em seg 21 abr 2014, às 17:28:16, Scott Aron Bloom escreveu:
> I have code, that sends a http request via  QNetworkAccessManager. 
> Unfortunately, there are times, where the network on the machine will 
> be up, but the connection to the internet is down.. Or the internet is 
> up, but the backend server is down.  Meaning, there is no way for my 
> application to "know" don't bother trying to connect. The problem, the 
> timeout for the request, before failure seems WAY WAY too long, upwards of 30 seconds.
> 
> 
> Is there any way to reduce this??  It's a very very fst request, a 3-5 
> second timeout, would actually be fine.

There's actually no timeout in QNAM. That timeout you're seeing is the QTcpSocket connection timeout. And no, it can't be changed.

If you want something shorter, create a QTimer.
--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

-------------

The only problem, is QNetworkRequests::abort isn't a slot :(  So I have to create an intermediary slot, figure out which request timedout, and abort it.

Scott



More information about the Interest mailing list