java - Unable to download files from FTP server -


I created a Java function that downloads files from an FTP server, it works fine with my local machine but I do not want it to be Linux The server needs to be run (the second host and port means) and the function returns an error

  not a collection of a statement, array, map, iterator, or counting part zero Can be  

with a code in line:

 for  (string) F: Fatpanames) {Ftpakliantkretriavefile (F, dew); // OS OutputStream}  

then this file does not appear ... I added

  ftpclient.enterRemotePassiveMode ();  

and ftpclient.getPassiveHost () returns entering in 227 passive mode (X, X, X, X, 204.15)

Shell tried downloading and downloading them in the list - it works.

How do I modify my code to solve the problem? Thank you.

UPD .

Full code: I

Fixed Boolean FTP file download (string ip, int port, string login, string passwood, string ftpdir, string locale) throws IOException {Boolean result = false; FTP Client Client = New FTPClient (); String separator = file. Separator; Try {Client.connect (IP, Port); Println (client.getReplyString ()); Client.login (login, passwd); Println (client.getReplyString ()); Client.setControlKeepAliveTimeout (1000 × 60 * 5); Client.setControlKeepAliveReplyTimeout (1000 × 60 * 5); Client.setFileType (FTP.BINARY_FILE_TYPE); System.out.println ("Customer Setfile Type Success"); Client.changeWorkingDirectory (ftpdir); Println (client.getReplyString ()); Client.printWorkingDirectory (); System.out.println ("Directory changed"); FTPFile [] ftpFiles = client.listFiles (); Println (ftpFiles); String [] ftpNames = client.listNames (); System.out.println ("files are" + Arrays.toString (ftpNames)); // here for so many tap ... (string f: ftpn name) {string localfile = local dir + f; OutputStream OS = New FileOutputStream (localfile); Try {result = client.retrieveFile (f, os); System.out.println ("downloading to get started"); System.out.println (client.getReplyString ()); client.noop ();} hold (exception e) {System.out.println ( E); Results = False;} Finally {if (os! = Null) os.close ();}} client.logout (); System.out.println (client.getReplyString ());} Hold (Exception e } {System.out.println (E); result = false;} {{client.disconnect ()}} hold (exception e) {System.out.println (e); result = wrong;}} return result;}

The error message states, you are trying to get a blank ing you to ingest on the object (Or make sure that the use of empty etherables may be probably)

If this is an executable (error) condition, then I will check it clearly and leave the exception of some time, such as:

  If throwing a new illegal order exception ("an empty set of FTP servers can not be used");} (string f: ftpNames) {ftpclient} .retrieveFile (f, os); // OS OutputStream}  

Alternatively you can try to continue with an FTP server, but it seems a bit useless.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -