Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 4.6.4: QNetworkAccessManager cannot close the connection
Forum Updated to NodeBB v4.3 + New Features

Qt 4.6.4: QNetworkAccessManager cannot close the connection

Scheduled Pinned Locked Moved Mobile and Embedded
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.
  • J Offline
    J Offline
    jonexi
    wrote on last edited by
    #1

    Hi,

    I'm developing an application in qt4.6.4 for symbian 5.2 which uses QNetworkAccessManager for HTTP communication.

    I'm facing a problem that connection is left open after usage, even QNetworkAccessManager and QNetworkReply class instances are deleted. I spent quite a lot time by trying different ways of delete instances, but nothing helps.
    However, connection is closed when application is exited.

    Has anyone faced same problem?
    Is there any way to close network connection by using those classes?

    I know connection can be closed by using QNetworkSession but in our environment
    it is still part of qt mobility api and we cannot take it into the use.

    @
    void webclient::go()
    {
    if (m_manager == NULL)
    {
    m_manager = new QNetworkAccessManager(this);

    }
    m_reply = m_manager->get(QNetworkRequest(QUrl("http://qt.nokia.com")));
        connect(m_manager, SIGNAL(finished(QNetworkReply*)),
                this, SLOT(handleFinished(QNetworkReply*)));
    

    }

    void webclient::handleFinished(QNetworkReply *reply)
    {
    //m_reply->deleteLater(); //this is also tried, and many other ways too..

    delete m_reply;
    m_reply = NULL;
    delete m_manager;
    m_manager = NULL;
    

    }
    @

    br,
    jonexi

    [edit: code highlighted / Denis Kormalev]

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lukiluuk
      wrote on last edited by
      #2

      As far as I know, it is not possible to close the connection without QNetworkSession. QNetworkAccessManager does not give you this option in Qt 4.6. In Qt 4.7 it is possible, I think.

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        hi, did you confirm that the handleFinished() slot was called ... there if you call the close() on m_reply, that should free the resources

        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