Not received QFtp's commandFinished signal
General and Desktop
4
Posts
3
Posters
3.9k
Views
1
Watching
-
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?
-
-
Thanks for your attention.
I try to give more info about my code.- The QFtp is created in run function of a QThread.
- Call connectToHost and login.
- 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.
- 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