[Qt-interest] wget vs. QHttp download
Christian Dähn
daehn at asinteg.de
Wed Nov 10 11:25:38 CET 2010
Hi,
Am Fr 05.11.2010 20:17 schrieb Konrad Rosenbaum <konrad at silmor.de>:
>On Friday 05 November 2010, Christian Dähn wrote:
>>I personally dislike the massive use and new dependencies to the main
>>event loop - till now I found no way to use QNAM in a blocking way -
>>like the waitForXxx() calls of QIODevice or QAbstractSocket.
>
>Simply create a local QEventLoop. I use code like this:
>
>QEventLoop myloop;
>connect(response,SIGNAL(finished()),&myloop,SLOT(quit()));
>connect(response,SIGNAL(error(QNetworkReply::NetworkError)),&myloop,SLOT(quit()));
>myloop.exec();
Thanks! Great idea - I even didn't know this (since I'm only working with Qt since year 2000)
and this solution seems much less error prone and much more convenient than calling
an optimized method like waitForReadyRead() ;-) ;-)
Sorry, but I already had some very serious problems with event loops for network
classes inside threads - because not all internal network events (which are sent from/to
the os' ip stack) support local event loops - some os events have to be dispatched by
the main event loop.
So: If no Troll corrects me, I have to assume that a network app running only a local
event loop cannot work correctly, if there's no running main event loop.
Best example:
QTcpServer cannot except / receive incoming connection using a local event loop
(I and some other developers tried this with Qt 4.5 and 4.6 this year and failed to get
a QTcpServer running with a local event loop).
Please correct me - but event loops and network stuff in Qt is far away from being
as easy as you mentioned / thought of.
ciao,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101110/30da452f/attachment.html
More information about the Qt-interest-old
mailing list