QNetworkAccessManager asynchronous API
-
wrote on 16 Aug 2011, 09:15 last edited by
As Qt document says:
@
QNetworkAccessManager manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply)),
this, SLOT(replyFinished(QNetworkReply*)));manager->get(QNetworkRequest(QUrl("http://qt.nokia.com")));
@bq. QNetworkAccessManager has an asynchronous API. When the replyFinished slot above is called, the parameter it takes is the QNetworkReply object containing the downloaded data as well as meta-data (headers, etc.).
I'm a little curious about the implementation of this asynchronous API.
Of course, Qt source code will give me the answer, but it's more convenience to get some basic explanation here :) -
wrote on 16 Aug 2011, 09:22 last edited by
What do you mean exactly? QNAM is built on top of QTcpSocket, which in turn has its async API (readyRead(), disconnected(), error(), etc. signals). So it's something like
QTcpSocket emits a signal -> some slot we don't know -> (read and process the data) -> emit QNetworkReply / QNetworkAccessManager signals.
The QTcpSocket async is built on top of an ordinary select(2). I briefly talked about this in this wiki page: http://developer.qt.nokia.com/wiki/Threads_Events_QObjects .
-
wrote on 16 Aug 2011, 09:44 last edited by
You answer is pretty clear, thanks.
So, it's based on select(2) sys call.
I just want to make sure. The link is very informative.
1/3