Results 1 to 3 of 3

Thread: posting to an invalid URL using QNetworkAccessManager

Threaded View

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

    Default Re: posting to an invalid URL using QNetworkAccessManager

    You needlessly create a new QNetworkAccessManager on each call to getData()
    Moreover, you never delete it. So each call to getData() leaks a QNetworkAccessManager instance.

    Since you already have m_networkManager as an instance member, only create one QNAM instance and re-use it.

    Regarding 2 QNAM: that is possible and does not create issues. Using one QNAM is usually more efficient since the instance can then do all kinds of tricks to optimize e.g. connects, like re-using sockets, re-using SSL sessions, etc.

    See Peter Hartmann's presentation at this year's Qt Developer Days: http://devdays.kdab.com/wp-content/u...k-features.pdf

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    sattu (8th January 2014)

Similar Threads

  1. Posting data to QWebView
    By chrisb123 in forum Newbie
    Replies: 5
    Last Post: 29th October 2009, 07:58
  2. Posting a QKeyEvent to a QLineEdit
    By cocheci in forum Qt Programming
    Replies: 14
    Last Post: 5th June 2006, 15:54

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.