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. Not received QFtp's commandFinished signal
Forum Updated to NodeBB v4.3 + New Features

Not received QFtp's commandFinished signal

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.9k 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.
  • M Offline
    M Offline
    mevip
    wrote on last edited by
    #1

    Not received QFtp's commandFinished signal, when execute a get command.
    All other pending commands will not be executed, for the get command is still in executing state.
    Why?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      I don't have one of these:

      !https://lh4.googleusercontent.com/-4TS9exAZjmI/TqtEl6qNvGI/AAAAAAAAA8Y/hp4WbG6ezWI/s800/02-IMG_1953.JPG(Crystal ball)!

      (picture taken by Volker at the DevDays)

      Perhaps you can show us the relevant sections of your code?

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        Did you connect to any remote host in the first place? Did it succeed? Did you connect to the stateChanged() signal to be notified if the remote host unexpectedly closes the connection?

        You may provide further details and/or code - this would help alot.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mevip
          wrote on last edited by
          #4

          Thanks for your attention.
          I try to give more info about my code.

          1. The QFtp is created in run function of a QThread.
          2. Call connectToHost and login.
          3. Call get to download a list file from the ftp server. The list file is a text file, every line represents a file's full path on the ftp server.
          4. Parse the list file and call get to download files in the list file one by one.

          After every QFtp command call, I will wait the command's result. The wait function is as below:
          @
          bool DoThread::waitFtpCmd(QFtp *ftp, const int waitSeconds)
          {
          QDateTime dtStart = QDateTime::currentDateTime();

          while(true)
          {
              qApp->processEvents();
          
              if (!ftp->hasPendingCommands() &&
                  ftp->currentCommand() == QFtp::None)
              {
                  if (ftp->error() != QFtp::NoError)
                  {
                      showInfo("Error", ftp->errorString());
                  }
                  else
                  {
                      showInfo("Ftp", "Cmd OK");
                  }
                  return ftp->error() == QFtp::NoError;
              }
          
              if (waitSeconds > 0 &&
                  dtStart.addSecs(waitSeconds) < QDateTime::currentDateTime())
              {
                  qDebug() << "ftp state: " << ftp->state();
                  qDebug() << "current cmd: " << ftp->currentCommand();
                  qDebug() << "pending cmds: " << ftp->hasPendingCommands();
                  showInfo("Error", "Cmd TimeOut");
                  break;
              }
          
              msleep(100);
          }//while
          
          return false;
          

          }
          @

          The problem occurs in the 4th step, after downlaod n files, while n maybe 1, 3 or any other number.
          All the file I want to download is the same size. Normally do

          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