×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    138

    How to map reply QNetworkAccessManager request?

    Hello,

    how one can map reply to get request sent?

    Code:
    void HTTP::manyRequests(QNetworkReply *reply) {
        manager = new QNetworkAccessManager(this);
        connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(done(QNetworkReply*)));
        manager->get(<url1>); // 1000ms
        manager->get(<url2>); // 10ms
        manager->get(<url3>); // 500ms
    ...
    }
    
    void HTTP::done(QNetworkReply *reply)
    {
        // How to map reply to get request?
    }
    There isn't any problem if you are sure that replies comes in the order where they was sent, but it isn't guaranteed.

    Should I create QNetworkAccessManager for each request? That doesn't sound an elegant solution.

    -Markku

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: How to map reply QNetworkAccessManager request?

    QNetworkAccessManager's get method returns a pointer to the QNetworkReply you will later receive in the slot. Alternatively QNetworkReply also contains the URL accessed.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: How to map reply QNetworkAccessManager request?

    Alternatively, you could also tie each Request object to a different slot.

    AFAIK, each of the requests will also emit signals...
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

Similar Threads

  1. Replies: 2
    Last Post: 2010-11-17, 12:45
  2. Replies: 1
    Last Post: 2010-06-22, 20:52
  3. SMS request a reply??
    By usc2424 in forum General Messaging
    Replies: 3
    Last Post: 2007-12-19, 12:18
  4. how to download DD+media object in one request-reply transaction?
    By Thanuja in forum Digital Rights Management & Content Downloading
    Replies: 0
    Last Post: 2006-10-20, 10:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×