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

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

Introduction

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

Prototype

@Override
public void disconnect() throws IOException 

Source Link

Document

Closes the control connection to the FTP server and sets to null some internal data so that the memory may be reclaimed by the garbage collector.

Usage

From source file:progparallele.Main.java

public static void testFTPChunks() {
    FTP ftp = new FTP();
    try {//from w  ww.j ava 2  s  .  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();
    }
}