Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkAccessManager advice
Qt 6.11 is out! See what's new in the release blog

QNetworkAccessManager advice

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 2.1k Views 2 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.
  • C Offline
    C Offline
    chopper
    wrote on last edited by chopper
    #1

    I'm looking to wrap some code I've got up into a utility library for others to use (and make it 'source available') - and some of my code uses a singleton wrapped QNetworkAccessManager object - but only connects to signals on the network reply objects.

    If someone uses this utility library and their code has their own QNetworkAccessManager which they rely on for separate uses - is there any way to protect the sanctity of my code's QNetworkAccessManager?) Is that even necessary any more?

    I seem to recall that pre-Qt5 there was at least some global state associated with a QNetworkAccessManager object and having more than one was problematic. I may be misremembering.

    Looking for advice from those who have used it in similar fashion - thanks :)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIR, there's no problem using several QNetworkAccessManager objects. Just remember that you can't have more than 6 concurrent requests. After that the following are queued.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 2 Replies Last reply
      3
      • SGaistS SGaist

        Hi,

        AFAIR, there's no problem using several QNetworkAccessManager objects. Just remember that you can't have more than 6 concurrent requests. After that the following are queued.

        C Offline
        C Offline
        chopper
        wrote on last edited by
        #3

        @SGaist - per process or per QNetworkAccessManager?

        If it's per process, that suggests an underlying singleton (in pattern, not object necessarily.)

        This would be worrying because it means that it's possible the client and the SDK are contending for the same 6 request resources across the entire process.

        Or - is the 6 connection limit a limit on connections to the same host? If so, then that's no worry at all.

        Thanks @SGaist - you make life much easier for all of us :) (Seriously - just knowing you're around is like a warm blanket of 'dude, chill')

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          AFAIR, there's no problem using several QNetworkAccessManager objects. Just remember that you can't have more than 6 concurrent requests. After that the following are queued.

          C Offline
          C Offline
          chopper
          wrote on last edited by
          #4

          @SGaist Looking at qtbase/src/network/access/qhttpnetworkconnection.cpp suggests that it is 6 connections, irrespective of destination, per network access manager.

          That would be great, as I can't step on the client (unless I do something really dumb) and the client can't step on me - they can (only in some expectedly rare cases) affect my network code's performance.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Yes, it's per QNAM object.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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