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. HTTP Pipelining in Qt?

HTTP Pipelining in Qt?

Scheduled Pinned Locked Moved General and Desktop
qt 5.4httphttp pipelining
4 Posts 2 Posters 2.1k 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.
  • A Offline
    A Offline
    Ashley
    wrote on last edited by Ashley
    #1

    I'm trying to implement http pipelining in Qt but I can't seem to get it working and there are no examples I can find on the internet. Currently my code looks like:

    slotDataReceived(QNetworkReply){
            --responsesPending
    
            // ... process reply...
    
            // Send more GET requests as needed
            while (responsesPending < maxPipelinedGets)          //maxPipelinedGets is set to 6
            {
                QUrl serverUrl;
                serverUrl.setHost(mAddress);
                serverUrl.setPort(mPort);
                serverUrl.setScheme("http");
                QNetworkRequest networkRequest(serverUrl);
                networkRequest.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
                networkRequest.setRawHeader("Host",mAddress.toLocal8Bit() + ":" + QString::number(mPort).toLocal8Bit());
                networkRequest.setRawHeader("Pragma", "no-cache");
                if(messageID != "")
                    networkRequest.setRawHeader("MsgID", messageID.toLocal8Bit());
    
                cout << "Sending HTTP GET request";
                networkManager->get(QNetworkRequest(*serverUrl));
                ++responsesPending;
            }
    }
    

    I still get responses from the server - but every time i get a response, 8 requests are sent, then 7 immediately come back with network reply errors, whilst one sits there waiting for another response, which suggests to me there is no http pipelining functionality present.

    If anyone could help direct me to a working solution that would be greatly appreciated! :)

    P.S. The server definitely supports pipelining - I have seen it working with straight C++.

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

      Hi,

      You might be hitting the limit number of connections in parallel that QNetworkAccessManager can do. It's described here.

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

      A 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You might be hitting the limit number of connections in parallel that QNetworkAccessManager can do. It's described here.

        A Offline
        A Offline
        Ashley
        wrote on last edited by
        #3

        @SGaist

        The limit number is 6 according to the description which is what my application is maxed to

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

          You can try using more QNAM bur in the end, creating many connection won't make it faster since you'll have a bottleneck with your connection's speed

          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