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. Correct way to setup proxy of QNetworkAccessManager
Forum Update on Monday, May 27th 2025

Correct way to setup proxy of QNetworkAccessManager

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 5.3k Views
  • 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.
  • T Offline
    T Offline
    tham
    wrote on 2 Jun 2017, 20:01 last edited by
    #1

    Is this a correct way to setup the proxy?I found the proxies list at here, I only pick the proxy do not need password and username

    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName("82.207.118.163");
    proxy.setPort(3128);
    manager->setProxy(proxy);
    

    The manager can download the images(those links all start with http) and the speed become much slower compare with the cases without proxy setting(sounds like it really go through the proxy?), is this a correct sign?

    If this is correct solution, how could I download/access websites with more than one proxy?
    my pc->proxy A->proxy B
    proxy B->proxy A->my pc

    Is this possible to be done by Qt5?Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Jun 2017, 20:44 last edited by
      #2

      Hi,

      You'd have to use several QNAM each with its own proxy.

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

      T 1 Reply Last reply 2 Jun 2017, 20:59
      0
      • S SGaist
        2 Jun 2017, 20:44

        Hi,

        You'd have to use several QNAM each with its own proxy.

        T Offline
        T Offline
        tham
        wrote on 2 Jun 2017, 20:59 last edited by
        #3

        @SGaist said in Correct way to setup proxy of QNetworkAccessManager:

        You'd have to use several QNAM each with its own proxy.

        Do you mean download/access websites with more than one proxy?
        Could you show me an example how to do it? Thanks

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 2 Jun 2017, 21:05 last edited by
          #4

          No, i mean use several QNetworkAccessManager (guess based on your variable name) objects. And you change the proxy for each of them.

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

          T 1 Reply Last reply 2 Jun 2017, 23:43
          0
          • S SGaist
            2 Jun 2017, 21:05

            No, i mean use several QNetworkAccessManager (guess based on your variable name) objects. And you change the proxy for each of them.

            T Offline
            T Offline
            tham
            wrote on 2 Jun 2017, 23:43 last edited by tham 6 Mar 2017, 02:44
            #5

            @SGaist said in Correct way to setup proxy of QNetworkAccessManager:

            No, i mean use several QNetworkAccessManager (guess based on your variable name) objects. And you change the proxy for each of them

            According to the document of setProxy(QNetworkAccessManager)

            the proxy to be used in future requests to be proxy. This does not affect requests that have already been sent.

            I think It should be fine even I change the proxy every time I open a new request based on the doc?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 3 Jun 2017, 20:05 last edited by
              #6

              IIRC, QNAM handles up to 6 request at the same time, the others are then queued and processed as soon as one finishes. So I don't know whether "sent" means also queued for later or just the currently working request.

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

              T 1 Reply Last reply 3 Jun 2017, 23:08
              0
              • S SGaist
                3 Jun 2017, 20:05

                IIRC, QNAM handles up to 6 request at the same time, the others are then queued and processed as soon as one finishes. So I don't know whether "sent" means also queued for later or just the currently working request.

                T Offline
                T Offline
                tham
                wrote on 3 Jun 2017, 23:08 last edited by
                #7

                @SGaist said in Correct way to setup proxy of QNetworkAccessManager:

                IIRC, QNAM handles up to 6 request at the same time, the others are then queued and processed as soon as one finishes. So I don't know whether "sent" means also queued for later or just the currently working request.

                I see, thanks for this info, it is fine with me, because I can queue the settings of proxies by myself.

                1 Reply Last reply
                0

                1/7

                2 Jun 2017, 20:01

                • Login

                • Login or register to search.
                1 out of 7
                • First post
                  1/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved