현재 QFtp와 관련된 이상한 문제에 직면하고 있습니다. FTP 서버에서 여러 파일을 다운로드하려고하지만 y 방향으로 x 파일을 다운로드 한 후 ftp->get()
명령이 완료되면 파일이 채워지지만 SIGNAL
commandFinished()
의 방출이 없으므로 다른 파일을 다운로드하지 않습니다. 내가 너무 많은 요청을했기 때문에 그것이 생각 나는 있지만, 심지어 Sleep(2000)
이 블록으로, 그 때문에 거부되었음을 처음에는QFtp commandFinished()를 방출하지 마십시오
void Ftp::commandFinished(int i, bool error)
{
if(ftp->currentCommand() == QFtp::Get)
{
if(error)
{
//blablabla-ERROR-blablabla
}
currentFile->close();
filesToDownload.pop_front();
processFileList();
}
/**Gestion de la commande Login (authentification de l'utilisateur)
*/
if(ftp->currentCommand() == QFtp::Login)
{//not utile here}
/**Gestion de la commande ConnectToHost (connexion au serveur)
*/
if (ftp->currentCommand() == QFtp::ConnectToHost)
{//not utile here}
/**Gestion de la commande List (téléchargement d'un fichier)
*/
if(ftp->currentCommand() == QFtp::List)
{
if(error)
{
//Nananana-FAIL-nanana
}
//!Tri des fichiers à télécharger en fonction de leur dernière date de modification
if (!filesToDownload.isEmpty())
{
currentPeripheral->setLastDownloadDate(newLastModifiedDate) ;
std::sort(filesToDownload.begin(),filesToDownload.end(),compareQUrlInfos);
processFileList();
}
}
}
void Ftp::processFileList()
{
QUrlInfo info;
if (filesToDownload.isEmpty())
{
//!Suicide de l'instance de Ftp
ftp->close();
disconnect(this,0,0,0);
this->deleteLater();
return ;
}
info = filesToDownload.first();
QDir dlDir(QString::number(currentPeripheral->getId()));
//!Si un fichier a été téléchargé, on déclenche son traitement
if (currentFile != nullptr)
{
emit(oneDownloadFinished(currentFile->fileName(),currentPeripheral));
delete currentFile;
currentFile = nullptr;
}
//!On crée un répertoire de téléchargement si nécessaire
if (!dlDir.exists())
{
dlDir.mkdir(".");
}
//!on crée le fichier qui contiendra le téléchargement
currentFile = new QFile(dlDir.filePath(info.name()));
if(!currentFile->open(QIODevice::WriteOnly))
{
delete currentFile;
currentFile = nullptr;
emit(writeToMonitoringConsole(QString("Erreur lors de la creation du fichier "+info.name()),"Error"));
return;
}
//Here I start (sometimes) a never ending fail
ftp->get(info.name(), currentFile);
}
:
여기 내 코드입니다. 차단이 훨씬 더 빠르게 나타납니다. 나는 대개 약 30 개의 파일을 다운로드 할 수 있습니다 (행운의 70, 한 번 200을 관리 할 때!). Sleep(2000)
으로 간신히 2-3 파일을 다운로드했습니다.
내게 실수입니까? QFTP에 제한 사항이 있습니까? 또는 다른 것 ? 편집
: 내가 그것을 게시 이후 SOMES 일을 테스트하고 dataTransferProgress() 신호를 모니터링 할 때 눈에 띄는 있었는지, 문제가있는 파일이 완전히 다운로드되어 있다는 점이다 (qDebug는 "88,928분의 88,928"라고)하지만 난 결코 commandFinished()를 입력하십시오.
내 슬롯 commandFinished은() 내 QFtp :: commandFinished 신호에 이런 식으로 연결되어: 나는 결코에 대한 commandFinished
를 수신하지 사용하십시오 FTPWidget
클래스와,
connect(ftp, SIGNAL(commandFinished(int,bool)), this, SLOT(commandFinished(int,bool)));
난 당신의 코드에서 어떤 commandFinished 신호가 표시되지 않는 등의 ID 으로 확인할 수 있습니까? 더 많은 코드를 공유해주십시오. – lpapp
명령 중 하나가 완료되면 commandFinished()가 QFtp에 의해 생성됩니다. 정상적으로이 신호를 보내면 안됩니다. [Qt commmandFinished] (http://qt-project.org/doc/qt-4.8/qftp.html#commandFinished) – Karalix
이것은 https://bugreports.qt.io/browse/QTBUG-19409 – x29a