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. QNetworkReply doesn't finish?
Forum Updated to NodeBB v4.3 + New Features

QNetworkReply doesn't finish?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 326 Views 3 Watching
  • 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.
  • S Offline
    S Offline
    Szymon. M. Sabat
    wrote on last edited by
    #1

    I have local FTP server I connect to with Total Commander without a problem. I'm trying to download a single file from it, using QNetworkAccessManager. No error is produced but it's never finished either. This is how I try to do it:

        QString surl = QString("ftp://%3/%4").arg(srv, fpath);
        url = QUrl(surl);
        url.setPort(port); //21
        //evaluates into ftp://192.168.0.102:21/Installer/VER
    
        if (url.isValid())
        {          //qnam is QNetworkAccessManager
                    reply = g->qnam->get(QNetworkRequest(url));
                    MyFTP::connect(reply.data(), &QNetworkReply::downloadProgress, g, &MyFTP::downloadProgress);
                    MyFTP::connect(reply.data(), &QNetworkReply::readyRead, g, &MyFTP::downloadReadyRead);
                    MyFTP::connect(reply.data(), &QNetworkReply::finished, g, &MyFTP::qnamReply);
                    MyFTP::connect(reply.data(), &QNetworkReply::sslErrors, g, &MyFTP::qnamSslErrors);
                    MyFTP::connect(reply.data(), &QNetworkReply::errorOccurred, g, &MyFTP::qnamError);
        }
    

    No singnal is ever produced by the QNetworkReply. I made a timer to check on it from time to time and it is stuck on "running" and "not finished" forever.

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

      Hi,

      Why are you connecting the pointer returned by reply.data rather than the reply itself ?

      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
      • S Offline
        S Offline
        Szymon. M. Sabat
        wrote on last edited by
        #3

        It's QPointer<QNetworkReply> so ::data() returns a pointer. Forgot to mention that.

        Also, I made it work by setting user and password in QUrl, not by setting QAuthenticator in response to QNetworkAccessManager::authenticationRequired. So... I don't understand why it didn't work before but now it works.

        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