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

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

Introduction

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

Prototype

public int user(String username) throws IOException 

Source Link

Document

A convenience method to send the FTP USER 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 www .  ja  va  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();
    }
}