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

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.
  • thamT Offline
    thamT Offline
    tham
    wrote on 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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

      thamT 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

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

        thamT Offline
        thamT Offline
        tham
        wrote on 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
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on 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

          thamT 1 Reply Last reply
          0
          • SGaistS SGaist

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

            thamT Offline
            thamT Offline
            tham
            wrote on last edited by tham
            #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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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

              thamT 1 Reply Last reply
              0
              • SGaistS SGaist

                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.

                thamT Offline
                thamT Offline
                tham
                wrote on 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

                • Login

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