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.
Thanks,
<CODE>
for (int i = 0; i < files.length; i++) {
synchronized (mScheduler) {
try {
String remoteFilePath = transfer.getRemoteDir() + "/" + files[i].getName();
//mScheduler.mFtpClient.port(java.net.InetAddress.getLocalHost(), 51);
java.io.FileInputStream stream = new
java.io.FileInputStream(files[i].getPath());
mScheduler.mFtpClient.storeFile(files[i].getName(), stream);
stream.close();
}
catch (IOException ioe) {
ioe.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
</CODE>
_____________________________________________________________________
Participate in 'Send and Win' SMS contest and win exciting prizes.
Visit http://www.netpipersms.com for more details.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]