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

Qt Code:
  1. QUrl url;
  2. url.setUserName( "ftp" );
  3. url.setPassword( "xxx" );
  4.  
  5. QNetworkAccessManager manager;
  6.  
  7. QEventLoop eventLoop;
  8.  
  9. connect( &manager, SIGNAL( finished( QNetworkReply* ) ),
  10. &eventLoop, SLOT( quit() ) );
  11.  
  12.  
  13. foreach ( const QString& file, fileList ) {
  14.  
  15. QUrl.setUurl( "ftp://ftp.xxx.com/" + file );
  16. QNetworkReply *reply = manager.get( QNetworkRequest( url ) );
  17.  
  18. /// block until each file is finished, how do I set timeout in the next line?
  19. eventLoop.exec();
  20.  
  21. /// get the reply content
  22. reply->readAll();
  23. ....
  24.  
  25. reply->deleteLater();
  26.  
  27. }
To copy to clipboard, switch view to plain text mode