Hi,
I need to ftp 30000 files from a particular website with same username and password, I am using the following code.
My question: will the ftp login 30000 times, or will it keep the connection alive during the entire ftp session until all files are ftped? Also how to I set timeout?
Thanks
url.setUserName( "ftp" );
url.setPassword( "xxx" );
QNetworkAccessManager manager;
connect( &manager, SIGNAL( finished( QNetworkReply* ) ),
&eventLoop, SLOT( quit() ) );
foreach ( const QString& file, fileList ) {
QUrl.
setUurl( "ftp://ftp.xxx.com/" + file );
QNetworkReply *reply = manager.get( QNetworkRequest( url ) );
/// block until each file is finished, how do I set timeout in the next line?
eventLoop.exec();
/// get the reply content
reply->readAll();
....
reply->deleteLater();
}
QUrl url;
url.setUserName( "ftp" );
url.setPassword( "xxx" );
QNetworkAccessManager manager;
QEventLoop eventLoop;
connect( &manager, SIGNAL( finished( QNetworkReply* ) ),
&eventLoop, SLOT( quit() ) );
foreach ( const QString& file, fileList ) {
QUrl.setUurl( "ftp://ftp.xxx.com/" + file );
QNetworkReply *reply = manager.get( QNetworkRequest( url ) );
/// block until each file is finished, how do I set timeout in the next line?
eventLoop.exec();
/// get the reply content
reply->readAll();
....
reply->deleteLater();
}
To copy to clipboard, switch view to plain text mode
Bookmarks