Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkAccessManager asynchronous API
Qt 6.11 is out! See what's new in the release blog

QNetworkAccessManager asynchronous API

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leonidwang
    wrote on last edited by
    #1

    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 :)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      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 .

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leonidwang
        wrote on last edited by
        #3

        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 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved