Correct. If you augment your debugging a little, it is easy to see the server sending a "Connection: close" header:
qDebug() << ... << reply->rawHeader("Connection"); On 25.07.2018 16:38, Sze Howe Koh wrote: > Hi all, > > Revisiting this topic after a hiatus. Thanks for confirming, Thiago and > Hamish. > > On 13 April 2018 at 10:08, Thiago Macieira <thiago.macie...@intel.com> wrote: >> On quinta-feira, 12 de abril de 2018 15:44:54 PDT Sze Howe Koh wrote: >>> Can QNAM re-use a TCP connection for multiple HTTP requests? >> >> Yes. It's the default. You don't have to do anything to enable it. > > In a quick test, I used 1 QNAM to download 12 files simultaneously. > (Windows 10 Pro x64 build 1803, using Qt 5.11.1 + MSVC 2015 32-bit) > > In Wireshark, I expected to see my PC send 6 SYNs (because QNAM does 6 > connections in parallel and re-uses connections) and 12 GETs (because > I'm downloading 12 files). > > However, I saw my PC send 12 SYNs and 12 GETs. I also saw the server > send 12 RSTs, 1 after each file finished downloading. My > interpretation is that the server terminates the connection after each > GET, which prevents connection re-use. Is this expected? > > Test code: > > const QStringList urls > { > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.win64_msvc2017_64/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.win64_msvc2015_64/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.win64_msvc2013_64/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.win32_msvc2015/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.win32_mingw53/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.qtwebengine/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.qtwebengine.win64_msvc2017_64/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.qtwebengine.win64_msvc2015_64/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.qtwebengine.win32_msvc2015/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.qtvirtualkeyboard/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.qtvirtualkeyboard.win64_msvc2017_64/5.9.0-0-201705291821meta.7z", > > "http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_59/qt.59.qtvirtualkeyboard.win64_msvc2015_64/5.9.0-0-201705291821meta.7z" > }; > QNetworkAccessManager nam; > for (auto url : urls) > { > auto reply = nam.get( QNetworkRequest( QUrl(url) ) ); > QObject::connect(reply, &QNetworkReply::finished, [=] > { > qDebug() << reply->request().url() << reply->readAll().size(); > reply->deleteLater(); > }); > } > > > Regards, > Sze-Howe > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest