[Qt-interest] QHttp timeout

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Jul 27 13:10:43 CEST 2010


Some more details...  Here is how I have done this, since both QNetworkAccessManager and the previous versions QHttp and QFtp dont have a "setTimout" function...
 
1) Create a single shot timer, with a timeout set to your timeout.  Connect its timeout signal to your slot to do the abort.
 
2a)  For QNAM, connection the readReady on the QNetworkReply returned from the "get/put/post" call on QNetworkAccessManager to the timers start slot, this resets it everytime data comes in
2b) for QHttp/QFtp connect the dataReadProgress signal of the QHttp object to the timers start slot.
 
3) on the finish,stop the timer.
4) In your timeout slot, abort the connection, I usually set a flag for reporting since the abort will trigger the finished signal.. 
 
BTW.. THIS CODE SHOULD BE PART OF THE QNAM ARCHITECTURE...  But Ive given up asking for it. It comes up every 3-6 months..
 
Scott
________________________________

From: qt-interest-bounces at trolltech.com on behalf of Markus Goetz
Sent: Tue 7/27/2010 3:20 AM
To: qt-interest at trolltech.com
Cc: ext Serge
Subject: Re: [Qt-interest] QHttp timeout



Hi,

Please port your code to use QNetworkAccessManager, we do not support QHttp
anymore.
You can use a QTimer to abort() the QNetworkReply yourself if no data is
arriving.

On Tuesday, July 27, 2010 11:38:43 am ext Serge wrote:
> Hello,
>
> Is it possible to change timeout, after which QHttp fails to connect to
> unreachable host?
>
> Thank you!
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100727/8e4a2f59/attachment.html 


More information about the Qt-interest-old mailing list