Important: Please read the Qt Code of Conduct -

QNetworkAccessManager downloading multiple files

  • I'm trying to download multiple files with QNetworkAccessManager. Everything works fine until an error occurs.

    file1 //good
    file2 //good
    file3 //bad, files after file3 will not processed

    Download will work perfect if no error occurs.

    QByteArray filename;
    QNetworkRequest myrequest;
    QNetworkReply *myreply = 0;
    foreach(QString file, m_downloadFileList) {
            filename = file.toAscii();
            myrequest = ftpRequest(filename);
            myreply = manager->get(myrequest);
            connect (myreply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(slDownload(qint64, qint64)));
            connect (myreply, SIGNAL(finished()), this, SLOT(slReadCompleted()));
            connect (myreply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slReplyError(QNetworkReply::NetworkError)));

    How to manage error handling, so I can download files after the first error.
    Do I have to delete the manager class every time if an error occurs?

  • Qt Champions 2017

    QNetworkAccessManager should not create issue as it queue the requests. My suspect is on QNetworkRequest object as u r using the same object. Also what that you are doing inside the slot when the error occurs ?

Log in to reply