Results 1 to 8 of 8

Thread: Count of QNetwork HTTP connections

  1. #1
    Join Date
    Apr 2014
    Posts
    125
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Question Count of QNetwork HTTP connections

    Hello

    For the client side:

    I want to know the maximum number of possible QNetwork HTTP connections (I'm using GET and POST) to a server?

    How can I know the current number of active QNetwork HTTP connections that I have on my client?

    How can I know the connection used by a particular QNetwork HTTP request?

    How can I know the connection used by a particular QNetwork HTTP reply?

    Thanks in advance.

    Mut.

  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: Count of QNetwork HTTP connections

    Quote Originally Posted by mut View Post
    I want to know the maximum number of possible QNetwork HTTP connections (I'm using GET and POST) to a server?
    I think a QNetworkAccessManager instance limits itself to 6 connections in total, not sure if it has an additional per-server limit.

    Quote Originally Posted by mut View Post
    How can I know the current number of active QNetwork HTTP connections that I have on my client?
    You can guess an upper limit by taking the minimum of pending QNetworkReply objects and 6 * number of QNetworkAccessManager instances.
    If you need to know the exact number you'll have to dig into QNetworkAccessManager's implementation

    Quote Originally Posted by mut View Post
    How can I know the connection used by a particular QNetwork HTTP request?
    Not from the API, but of course you have the code so you are not necessarily limited by that.

    Quote Originally Posted by mut View Post
    How can I know the connection used by a particular QNetwork HTTP reply?
    That's the same connection as the request, HTTP is a request/response protocol, it can't to reverse connections control/data channel dual connections.

    Cheers,
    _

  3. #3
    Join Date
    Apr 2014
    Posts
    125
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: Count of QNetwork HTTP connections

    Thanks for the replies. I'm focusing on the client side. What I want to know on the client (per ip address to the server) is which one of the below is correct:
    1) Fixed pool of connections, a connection is immediately freed when unused and taken by new entrant
    2) unlimited amount of connections, unused connections are kept alive for until time out period, hence connection count can grow quickly

    You seems to indicate that that it is option 1, can you please reconfirm?

    Could you please also be so kind as to elaborate on "QNetworkReply objects and 6 * number of QNetworkAccessManager instances."

    Thanks

    Mut

  4. #4
    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: Count of QNetwork HTTP connections

    Quote Originally Posted by mut View Post
    You seems to indicate that that it is option 1, can you please reconfirm?
    From a cursory glance at the code that seems to be the case, yes.
    Requests seem to be queued unless the current connection count is below the maximum threshold.

    Quote Originally Posted by mut View Post
    Could you please also be so kind as to elaborate on "QNetworkReply objects and 6 * number of QNetworkAccessManager instances."
    If you have three active QNetworkReply objects, then you very likely have 3 connections.
    If you have more than 6 on a single QNetworkAccessManager, then 6 would be the limit.

    Cheers,
    _

  5. #5
    Join Date
    Apr 2014
    Posts
    125
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: Count of QNetwork HTTP connections

    Thanks again for the reply.

    Are you saying that on the client side there is one QNetworkAccessManager per server ip?

    Can you please confirm the below:
    - Maximum is 6 connections per QNetworkAccessManager?
    - If I have 9 QNetworkReply objects, 6 will be active and 3 will be queued?

    Can you point me to the lines of the qt source code (5.5 or later) where queuing of connections occurs?

    Mut

  6. #6
    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: Count of QNetwork HTTP connections

    Quote Originally Posted by mut View Post
    Are you saying that on the client side there is one QNetworkAccessManager per server ip?
    There are as many QNetworkAccessManager objects as you create.

    Quote Originally Posted by mut View Post
    Can you please confirm the below:
    - Maximum is 6 connections per QNetworkAccessManager?
    https://code.woboq.org/qt5/qtbase/sr...pChannelCountE

    Quote Originally Posted by mut View Post
    - If I have 9 QNetworkReply objects, 6 will be active and 3 will be queued?
    That would be my expectation.

    Quote Originally Posted by mut View Post
    Can you point me to the lines of the qt source code (5.5 or later) where queuing of connections occurs?
    https://code.woboq.org/qt5/qtbase/sr...NetworkRequest

    Cheers,
    _

  7. #7
    Join Date
    Apr 2014
    Posts
    125
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: Count of QNetwork HTTP connections

    Thanks again. I m wondering if this maximum number of 6 connections can be adjusted and how to do that? Will adjusting it being safe and does not risk breaking qtnewtork?

  8. #8
    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: Count of QNetwork HTTP connections

    You'll have to check if the variable that gets initialized with the hard coded default count also appears in some setter somewhere.

    If it does I am pretty sure that changing it doesn't impose any problems.

    Changing the default and using a custom Qt version should also not be any problem.

    Cheers,
    _

Similar Threads

  1. Problem with Qnetwork cookies and getting code after login
    By DomantasB in forum Qt Programming
    Replies: 8
    Last Post: 14th November 2013, 11:21
  2. qnetwork manager does not allow redirection?
    By JeanC in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2011, 10:59
  3. Replies: 0
    Last Post: 6th March 2011, 11:42
  4. Connect internet for Qnetwork S60
    By Thành Viên Mới in forum Qt Programming
    Replies: 2
    Last Post: 5th June 2010, 04:41
  5. Tracking multiple requests with QNetwork
    By rbp in forum Qt Programming
    Replies: 4
    Last Post: 1st June 2010, 09:04

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.