Example usage for org.apache.commons.net.ftp FTP pass

List of usage examples for org.apache.commons.net.ftp FTP pass

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTP pass.

Prototype

public int pass(String password) throws IOException 

Source Link

Document

A convenience method to send the FTP PASS command to the server, receive the reply, and return the reply code.

Usage

From source file:progparallele.Main.java

public static void testFTPChunks() {
    FTP ftp = new FTP();
    try {//from  w  w w.jav a  2s.c om
        ftp.connect(hostname, port);
        int reply = ftp.getReplyCode();
        if (reply != 220) {
            ftp.disconnect();
            return;
        }

        ftp.user("anonymous");
        ftp.pass("");

        ftp.disconnect();
    } catch (IOException e) {
        e.printStackTrace();
    }
}