Hello!

I'm having problems downloading zip files using the FTPSClient with the apache ftp server. It works fine on Mac clients but not windows clients.

Here's the test code (replace *** with your info):

public class testFTP{
    private FTPSClient ftps;

    public testFTP(){
        try{
            String host = "***";
            int port = ***;
            String zipname = "CompleteProject.zip";
        
            ftps = new FTPSClient(true);
            ftps.connect(host,port);
            System.out.println(ftps.getReplyString());
            ftps.setFileType(FTP.BINARY_FILE_TYPE);
            ftps.login("***", "***");
            System.out.println("Remote system is " + ftps.getSystemName());
        
            ftps.enterLocalPassiveMode();
        
            FileOutputStream output=new FileOutputStream(new File(zipname));
            boolean result = ftps.retrieveFile(zipname,output);
        
            if (!result) {
                System.out.println("Error retrieving file");
            }
        
            ftps.disconnect();
        }

        catch(Exception e){
            System.out.println("An error occured");
        }
    }

    public static void main(String args[]){
        testFTP f= new testFTP();
    }
}


Here's the error I'm getting when trying to unzip the result from the test code above:

$ unzip CompleteProject.zip
Archive:  CompleteProject.zip
warning [CompleteProject.zip]: 49109 extra bytes at beginning or within zipfile
  (attempting to process anyway)
file #1:  bad zipfile offset (local header sig):  49109
  (attempting to re-compensate)
  inflating: CompleteProject.eaf
  error:  invalid compressed data to inflate
file #2:  bad zipfile offset (local header sig):  2036
  (attempting to re-compensate)
file #2:  bad zipfile offset (local header sig):  2036
file #3:  bad zipfile offset (local header sig):  7225427
file #4:  bad zipfile offset (local header sig):  13119171
file #5:  bad zipfile offset (local header sig):  13312603
  inflating: CompleteProject_MetaData.xml


Any hints appreciated!

Thanks,

Susanne



On Oct 4, 2006, at 4:50 PM, Rory Winston wrote:

Hi Susanne

TLS support is in the works, but has not made it into an official release yet. If you are using JDK 5.0, you can try out a snapshot of the new release here:

http://people.apache.org/~rwinston/commons-net-2.0/

An example of usage is here:

http://svn.apache.org/viewvc/jakarta/commons/proper/net/branches/ JDK_1_5_BRANCH/src/main/java/examples/FTPSExample.java?view=markup

Cheers
Rory


Susanne Lefvert wrote:

Hi there,

Do you know if there are any examples out there where the commons ftp client has been extended to support TLS. I need to connect to an ftp server that requires SSL and I'm looking for a ftp client library that I can use in my application. The apache commons ftp client looks really good, it's just missing the TLS piece. Any hints greatly appreciated.

Thanks,

Susanne

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to