commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mohammed Abbas" <>
Subject Multiple File using FTP Client [Commons Net]
Date Sun, 16 May 2004 08:58:31 GMT
Hi All, 

Im truly bugged for time and I would really need some help. 
Part of my project requires me to use an FTP Client that can send sceheduled tasks to a FTP
Server residing on my network. All went well when I tried using this operation on one file
but now I having problems implemeting the same logic with multiple files (binary). Im using
a Timer to schedule the events to a Timer Task that lists all the files in the directory and
passes them FTP Client reference in the TimerTask. 
When Im getting is that when the task is handling one file it returns a FileTransfer OK (250)
then a disconnection from the FTP Server and the program exits. Refering back to some logs
using a different FTP Software the PORT Command is called after successive calls to the FTPServer
and does so for until there are no files (I already tried simulating the scenario using the
SocketClient APIs but Im still getting the same result.) 

Im initialising the FTPClient (connecting,validating connection then logging in + setting
binary filetype --- already active mode). Then I'm passing storing the file using the store(String,
FileInputStream) method. Im iterating the stor operation through a loop with no checks) 

1) Is this is the way that its supposed to be done? If not how then. 
2) Would it matter if I used the default Active mode instead of the Pasv mode. Which one is
better programmatically. 
3) I cant find any samples for the multiple stor operation. Can someone please attach a some
code samples for the multiple send. 


for (int i = 0; i < files.length; i++) {
  synchronized (mScheduler) {
     try {
  	  String remoteFilePath = transfer.getRemoteDir() + "/" + files[i].getName();
	  //mScheduler.mFtpClient.port(, 51); stream = new[i].getPath());
	  mScheduler.mFtpClient.storeFile(files[i].getName(), stream);
	catch (IOException ioe) {
	catch (Exception e) {


Participate in 'Send and Win' SMS contest and win exciting prizes. 
Visit for more details. 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message