Results 1 to 3 of 3

Thread: QNetworkAccessManager keep-alive ?

  1. #1
    Join Date
    Apr 2009
    Posts
    35
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Android

    Default QNetworkAccessManager keep-alive ?

    I'm use QNetworkAccessManager to visit couchdb
    Qt Code:
    1. http://127.0.0.1:5984/chat/_changes?feed=continuous&since=1
    To copy to clipboard, switch view to plain text mode 
    couchdb args continuous means http keep-alive

    Qt Code:
    1. m_getContinuousManager = new QNetworkAccessManager(this);
    2.  
    3. connect(m_getContinuousManager, SIGNAL(finished(QNetworkReply*)),
    4. this, SLOT(newMsg(QNetworkReply*)));
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void newMsg(QNetworkReply *reply)
    2. {
    3. qDebug() << reply->readAll()
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

    but my function newMsg only exec once

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QNetworkAccessManager keep-alive ?

    Right.
    If the "continuous" means that the connection is kept open, your slot shouldn't be called at all.

    Maybe the server does end the HTTP request?

    Cheers,
    _

  3. #3
    Join Date
    Feb 2015
    Posts
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QNetworkAccessManager keep-alive ?

    Did you try to repeat your code
    m_getContinuousManager = new QNetworkAccessManager(this);
    connect(m_getContinuousManager, SIGNAL(finished(QNetworkReply*)),
    this, SLOT(newMsg(QNetworkReply*)));
    in newMsg?

Similar Threads

  1. Example for QNetworkAccessManager with SSL
    By KeineAhnung in forum Newbie
    Replies: 1
    Last Post: 12th February 2016, 13:52
  2. Rest Web Service - Keep-alive Connection
    By buleron in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 29th May 2015, 15:54
  3. How to use QNetworkAccessManager?
    By radmir in forum Newbie
    Replies: 1
    Last Post: 25th February 2013, 14:43
  4. QNetworkAccessManager
    By cuteatul in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2011, 05:34
  5. QTcpSocket and keep-alive option.
    By fanat9 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2008, 16:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.