Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2010

    Question How to close an internet connection started with QNetworkSession

    in my app i want to start an internetconnection, download something and afterwards close the connection, to save battery. I started the connection as in one of the tutorials available from nokia with a QNetworkSession. Everything works well, but the connection's state never goes to closed, after I close the connection in the finished() slot in my app. I already searched for this problem here, but nobody had a sollution. The docs say, that it should work, if all sessions which were opened are closed. I only open one session, and the internet connection gets established. But it will never disconnect.
    The steps I do are:

    // Set Internet Access Point
    QNetworkConfigurationManager manager;

    const bool canStartIAP = (manager.capabilities()
    & QNetworkConfigurationManager::CanStartAndStopInterfaces);

    // Is there default access point, use it
    QNetworkConfiguration cfg = manager.defaultConfiguration();

    if (!cfg.isValid() || !canStartIAP) {
    // Available Access Points not found
    QMessageBox::information(this,"Bearer","Available Access Points not found");

    // Open session
    m_session = new QNetworkSession(cfg);
    connect(m_session, SIGNAL(closed()), this, SLOT(closed()));
    connect(m_session, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(stateChanged(QNetworkSession::State)));
    connect(m_session, SIGNAL(error(QNetworkSession::SessionError)), this, SLOT(error(QNetworkSession::SessionError)));
    // Waits for session to be open and continues after that

    I close the session in the finished() slot.

    Thanks in advance for any suggestions

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003

    Re: How to close an internet connection started with QNetworkSession

    You could maybe check the API docs for available functions: http://doc.qt.nokia.com/latest/qnetworksession.html

    Basically you should use close(), and if nobody else is using the connection, it should be closed. Then if you would really want to terminate the connection you would use stop(), but with Symbian you would need to have network control capability to get it actually functioning.

  3. #3
    Registered User
    Join Date
    May 2010

    Re: How to close an internet connection started with QNetworkSession

    Thanks for Your reply,
    did You get it working the way it is described in the docs? I did not. As I understand, the connection should be terminated if no more session is open, but if You close the session with close() You will never get to the closed state in the according slot. I tried with stop() already, with the same result.

Similar Threads

  1. new nokia wifi location service don't close internet connection
    By xlazom00 in forum Series 40 & S60 Platform Feedback Archive
    Replies: 5
    Last Post: 2010-06-21, 08:37
  2. How to use my PCs connection to the internet to connect my mobile to the internet?
    By iamrohitbanga in forum General Development Questions
    Replies: 3
    Last Post: 2009-10-07, 19:14
  3. RHTTPTransaction::Close() Does close the connection also?
    By anand_zain76 in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2007-10-27, 17:09
  4. Replies: 3
    Last Post: 2006-10-03, 21:54

Posting Permissions

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