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. QNetworkAccessManager long delay to emit finished signal

QNetworkAccessManager long delay to emit finished signal

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k Views 1 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.
  • V Offline
    V Offline
    vinid3
    wrote on last edited by
    #1

    I use a QNAM to handle uploads using a ftp protocol. The whole process works but I have a strange behavior:

    this is my method :
    @void ftp::uploadFile(const QString &origin, const QString &destination)
    {
    QUrl url("ftp://"+host+""+destination);
    url.setUserName(user);
    url.setPassword(pwd);
    url.setPort(21);

    localFile = new QFile(origin, this);
    if (localFile->open(QIODevice::ReadOnly))
    {
         reply = nam->put(QNetworkRequest(url), localFile);
         QObject::connect(reply, SIGNAL(uploadProgress(qint64, qint64)), SLOT(transferProgress(qint64, qint64)));        
         QObject::connect(reply, SIGNAL(finished()), this, SLOT(transferFinished()));
    }
    else qDebug() << localFile->errorString();
    

    }@

    When I upload a file, the uploadProgress is emitted :

    @qDebug() << sent << "/" << total;@

    outputs the 0/x till the x/x . Then it takes a long time, maybe up to 20 seconds before the finished signal is emitted. Why this delay?

    I tried ignoring the finished signal and emit the signal myself when the progress is at sent==total but the file is corrupted at the other end. (It's not really corrupted, as I only send jpg, The resulting file is an upper-half only jpg. a big part is just grey.)

    I'd like to provide my users with a progress bar where 100% really means the process is finished. Uploading for 5 seconds, then staying for 20 seconds at 100% isn't really nice. What am I doing wrong?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DJ_Lectr0
      wrote on last edited by
      #2

      I have the exact same problem except over http. I have found out that also the download progress signal takes this long time. And it is not because of my internet connection, bc it needs to download 60 bytes.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DJ_Lectr0
        wrote on last edited by
        #3

        I have the exact same problem except over http. I have found out that also the download progress signal takes this long time. And it is not because of my internet connection, bc it needs to download 60 bytes.

        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