I thought I might include the original text from the FTP Server if it may help:


Thu May 13 19:05:14 2004  2  Incoming connection request on interface 127.0.0.1
Thu May 13 19:05:14 2004  2  Connection request accepted from 127.0.0.1
Thu May 13 19:05:14 2004  2  USER BLOGG
Thu May 13 19:05:14 2004  2  331 User BLOGG, password please  
Thu May 13 19:05:14 2004  2  PASS ***********
Thu May 13 19:05:14 2004  2  230 Password Ok, User logged in  
Thu May 13 19:05:14 2004  2  TYPE I
Thu May 13 19:05:14 2004  2  200 Type Binary  
Thu May 13 19:05:14 2004  2  CWD /Uploads/
Thu May 13 19:05:14 2004  2  250 Change directory ok  
Thu May 13 19:05:14 2004  2  PORT 127,0,0,1,4,33
Thu May 13 19:05:14 2004  2  200 Port command received  
Thu May 13 19:05:14 2004  2  STOR BLOGG
Thu May 13 19:05:14 2004  2  Data connection established
Thu May 13 19:05:14 2004  2  150 Opening data connection  
Thu May 13 19:05:14 2004  2  Error closing connection: An established connection was 
aborted by the software in your host machine.
Thu May 13 19:05:14 2004  2  An existing connection was forcibly closed by the remote 
host.
Thu May 13 19:05:14 2004  2  500 File transfer failed  
Thu May 13 19:05:14 2004  2  Connection terminated.

---------- Original Message ----------------------------------
From: "Mohammed Abbas" <[EMAIL PROTECTED]>
Reply-To: <[EMAIL PROTECTED]>
Date:  Thu, 13 May 2004 19:27:19 +0400

>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]

Reply via email to