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. Downloading a File with QNetworkAccessManager is 30 Times Slower than It Should Be
Forum Updated to NodeBB v4.3 + New Features

Downloading a File with QNetworkAccessManager is 30 Times Slower than It Should Be

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 429 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.
  • QrqtowQ Offline
    QrqtowQ Offline
    Qrqtow
    wrote on last edited by Qrqtow
    #1

    This is the code I'm using

    	QElapsedTimer* timer = new QElapsedTimer;
    	timer->start();
    	QNetworkAccessManager* manager = new QNetworkAccessManager;
    	QObject::connect(manager, &QNetworkAccessManager::finished,
    		this, [=](QNetworkReply* reply)
    	{
    			cout << timer->elapsed();
    		}
    	});
    	std::string urlS = "https://someUrl/file.zip";
    	QNetworkRequest req(QUrl(QString::fromStdString(urlS)));
    	manager->get(req);
    

    It takes about 150 seconds to download my file that way, while downloading it any other way (chrome, postman, curl, libcurl) takes 5 seconds. I guess it has something to do with tls because while experimenting I noticed the problem only happens for https requests.

    I'm using Qt 6.2.2 on windows and the tls dlls I'm using are the ones that are installed by the qt installer.
    48e16100-5140-4434-892c-89b29a61d3ef-image.png

    jsulmJ 1 Reply Last reply
    0
    • QrqtowQ Qrqtow

      This is the code I'm using

      	QElapsedTimer* timer = new QElapsedTimer;
      	timer->start();
      	QNetworkAccessManager* manager = new QNetworkAccessManager;
      	QObject::connect(manager, &QNetworkAccessManager::finished,
      		this, [=](QNetworkReply* reply)
      	{
      			cout << timer->elapsed();
      		}
      	});
      	std::string urlS = "https://someUrl/file.zip";
      	QNetworkRequest req(QUrl(QString::fromStdString(urlS)));
      	manager->get(req);
      

      It takes about 150 seconds to download my file that way, while downloading it any other way (chrome, postman, curl, libcurl) takes 5 seconds. I guess it has something to do with tls because while experimenting I noticed the problem only happens for https requests.

      I'm using Qt 6.2.2 on windows and the tls dlls I'm using are the ones that are installed by the qt installer.
      48e16100-5140-4434-892c-89b29a61d3ef-image.png

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Qrqtow You should also connect slots to
      https://doc.qt.io/qt-5/qnetworkreply.html#error https://doc.qt.io/qt-5/qnetworkaccessmanager.html#sslErrors
      https://doc.qt.io/qt-5/qnetworkreply.html#errorOccurred
      https://doc.qt.io/qt-5/qnetworkreply.html#sslErrors

      Check https://doc.qt.io/qt-5/qnetworkreply.html#error

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      QrqtowQ 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Qrqtow You should also connect slots to
        https://doc.qt.io/qt-5/qnetworkreply.html#error https://doc.qt.io/qt-5/qnetworkaccessmanager.html#sslErrors
        https://doc.qt.io/qt-5/qnetworkreply.html#errorOccurred
        https://doc.qt.io/qt-5/qnetworkreply.html#sslErrors

        Check https://doc.qt.io/qt-5/qnetworkreply.html#error

        QrqtowQ Offline
        QrqtowQ Offline
        Qrqtow
        wrote on last edited by Qrqtow
        #3

        @jsulm None of them is emitted and the file is downloaded successfully. What else can I try?

        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