Important: Please read the Qt Code of Conduct -

Not received QFtp's commandFinished signal

  • 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.

  • I don't have one of these:

    ! ball)!

    (picture taken by Volker at the DevDays)

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

  • 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.

  • 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();

        if (!ftp->hasPendingCommands() &&
            ftp->currentCommand() == QFtp::None)
            if (ftp->error() != QFtp::NoError)
                showInfo("Error", ftp->errorString());
                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");
    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

Log in to reply