commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Dovale <edov...@carosys.com>
Subject Re: FTP 150 Opening ASCII mode data connection for "file name"
Date Sat, 17 Dec 2005 15:39:11 GMT
Hi Benjamin,
Yes, it looks pretty much like that. My problem is that when I call

FTPReply.isPositiveIntermediate(ftp.getReplyCode()) it return false because reply code 150
is not a positive intermediate code. 

My code looks more like the sample in the javadocs:

 InputStream input;
 OutputStream output;
 input  = new FileInputStream("foobaz.txt");
 output = ftp.storeFileStream("foobar.txt")
 if(!FTPReply.isPositiveIntermediate(ftp.getReplyCode())) {
     input.close();
     output.close();
     ftp.logout();
     ftp.disconnect();
     System.err.println("File transfer failed.");
     System.exit(1);
 }
 Util.copyStream(input, output);
 input.close();
 output.close();
 // Must call completePendingCommand() to finish command.
 if(!ftp.completePendingCommand()) {
     ftp.logout();
     ftp.disconnect();
     System.err.println("File transfer failed.");
     System.exit(1);
 }

Thanks, 

erick.


Jurado, Benjamin - BLS CTR wrote:

>Erick
>I have recently started to work with commons-net...lets see if this is
>of any use to you.
>Your code looks something like this?
>
>
> InputStream in = null;
>   
>    try {
>      File fileObj = new File(filename);
>      
>      in = new FileInputStream(fileObj);
>      ftp.changeWorkingDirectory(this.remoteDir);
>      ftp.storeFile(fileObj.getName(),in);
>    
>      if(FTPReply.isPositiveIntermediate(ftp.getReplyCode())){
>        System.out.println("Intermediate Results do something");
>      }
>      if(FTPReply.isPositiveCompletion(ftp.getReplyCode())){
>        System.out.println("positive Completion");
>      }
>      
>      
>    } catch (FileNotFoundException e) {
>      e.printStackTrace();
>    } catch (IOException e) {
>      e.printStackTrace();
>    }finally{
>      try {
>        in.close();
>      } catch (IOException e) {
>        e.printStackTrace();
>      }
>    } 
>?
>Ben
>-----Original Message-----
>From: Erick Dovale [mailto:edovale@carosys.com] 
>Sent: Saturday, December 17, 2005 10:05 AM
>To: Jakarta Commons Users List
>Subject: Re: FTP 150 Opening ASCII mode data connection for "file name"
>
>
>I am sorry I forgot some details.
>The actual problem is that after calling storeFileStream I am calling 
>FTPReply.isPositiveIntermediate(ftpClient.getReplyCode() and this 
>function returns false when passed the 150 reply code.
>If I ignore this call and try to continuo transmision it hangs. Hope
>that helps
>
>Erick Dovale wrote:
>
>  
>
>>Hello there folks,
>>My apologies if this was previously asked. I was browsing in the
>>archives and could not find it.
>>I am trying to upload files to an ftp server using FTPClient from 
>>commons-net-1.4.1. Every time I try i get error code 150 Opening ASCII
>>    
>>
>
>  
>
>>mode data connection for <the file name of the file I am sending>.
>>In the ftp folder the file gets created but with 0 bytes file size. I 
>>have tried 2 different ftp servers and I get exactly the same in both 
>>of them.
>>I am positive this may be a very simple configuration issue; I just 
>>can not nail it.
>>Any hints???
>>
>>thanks in advance..
>>
>>erick.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message