commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Johnson <chach...@gmail.com>
Subject Commons/Net Documentation
Date Mon, 09 Jan 2006 20:31:07 GMT
Hi there

I'm trying to find basic documentation for the Commons/Net package, and both
links that I see here http://jakarta.apache.org/commons/net/ are rather
unhelpful.

What I'm trying to do is fairly straigtforward

1. Connect to a known FTP server
2. Login to said FTP server using known userid and password
3. set the transfer type to ASCII
4. Transfer a file (whose location I have) to a subdirectory (/uploadTest)
5. close the connection
6. do allapproriate error checking.

I dont see that sort of basic information in the JavaDocs..

what I have so far is

FTPClient ftpServer=new FTPClient();
FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
ftpServer.configure(conf);

boolean error = false;
try {
    int reply;

    ftpServer.connect(commonLocation);
    System.out.println("Connected to " + commonLocation + ".");
    System.out.print(ftpServer.getReplyString());

    reply = ftpServer.getReplyCode();

    if(!FTPReply.isPositiveCompletion(reply)) {
        ftpServer.disconnect();
        System.err.println("Error -- FTP server refused connection.");
    }

    ftpServer.login(ftpUser, ftpPass);
    // Set the transfer type
    // Chenge directories
    // transfer file

    ftpServer.logout();
} catch(IOException e) {
    error = true;
    e.printStackTrace();
} finally {
    if(ftpServer.isConnected()) {
        try {
            ftpServer.disconnect();
        } catch(IOException ioe) {
            // do nothing
        }
    }
}

where can I go to get this info?

--
-Dave
ChaChaNY@Gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message