Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClient.connect()


    }

    private void ftpUpload(String srcFileName, String distLocation) throws IOException {
        FTPClient client = new FTPClient();
        FileInputStream fis = null;
        client.connect(srvHost);
        client.login(userName, password);
        client.changeWorkingDirectory(distLocation);
        String filename = srcFileName;
        fis = new FileInputStream(filename);
        client.storeFile(filename, fis);
View Full Code Here


    String host = conf.get("fs.ftp.host");
    int port = conf.getInt("fs.ftp.host.port", FTP.DEFAULT_PORT);
    String user = conf.get("fs.ftp.user." + host);
    String password = conf.get("fs.ftp.password." + host);
    client = new FTPClient();
    client.connect(host, port);
    int reply = client.getReplyCode();
    if (!FTPReply.isPositiveCompletion(reply)) {
      throw new IOException("Server - " + host
          + " refused connection on port - " + port);
    } else if (client.login(user, password)) {
View Full Code Here

        final FTPClient client = new FTPClient();
        String host = getConfiguration().getHost();
        int port = getConfiguration().getPort();
        log.debug("Connecting to host: " + host + " port: " + port);

        client.connect(host, port);
        client.login(getConfiguration().getUsername(), getConfiguration().getPassword());
        client.setFileType(getConfiguration().isBinary() ? FTPClient.BINARY_FILE_TYPE : FTPClient.ASCII_FILE_TYPE);
        return client;
    }
}
View Full Code Here

    String host = conf.get("fs.ftp.host");
    int port = conf.getInt("fs.ftp.host.port", FTP.DEFAULT_PORT);
    String user = conf.get("fs.ftp.user." + host);
    String password = conf.get("fs.ftp.password." + host);
    client = new FTPClient();
    client.connect(host, port);
    int reply = client.getReplyCode();
    if (!FTPReply.isPositiveCompletion(reply)) {
      throw new IOException("Server - " + host
          + " refused connection on port - " + port);
    } else if (client.login(user, password)) {
View Full Code Here

    String host = conf.get("fs.ftp.host");
    int port = conf.getInt("fs.ftp.host.port", FTP.DEFAULT_PORT);
    String user = conf.get("fs.ftp.user." + host);
    String password = conf.get("fs.ftp.password." + host);
    client = new FTPClient();
    client.connect(host, port);
    int reply = client.getReplyCode();
    if (!FTPReply.isPositiveCompletion(reply)) {
      throw new IOException("Server - " + host
          + " refused connection on port - " + port);
    } else if (client.login(user, password)) {
View Full Code Here

    client.disconnect();
  }

  private FTPClient getFtpClient() throws SocketException, IOException {
    FTPClient client = new FTPClient();
    client.connect(getFtpHost());
    client.login(getFtpLogin(), getFtpPassword());
    client.changeWorkingDirectory(getFtpBackupPath());
    client.setFileType(FTPClient.BINARY_FILE_TYPE);
    return client;
  }
View Full Code Here

        try {
            log("Opening FTP connection to " + server, Project.MSG_VERBOSE);

            ftp = new FTPClient();

            ftp.connect(server, port);
            if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
                throw new BuildException("FTP connection failed: "
                     + ftp.getReplyString());
            }
View Full Code Here

    String host = conf.get("fs.ftp.host");
    int port = conf.getInt("fs.ftp.host.port", FTP.DEFAULT_PORT);
    String user = conf.get("fs.ftp.user." + host);
    String password = conf.get("fs.ftp.password." + host);
    client = new FTPClient();
    client.connect(host, port);
    int reply = client.getReplyCode();
    if (!FTPReply.isPositiveCompletion(reply)) {
      throw new IOException("Server - " + host
          + " refused connection on port - " + port);
    } else if (client.login(user, password)) {
View Full Code Here

        ftp2.addProtocolCommandListener(listener);

        try
        {
            int reply;
            ftp1.connect(server1);
            System.out.println("Connected to " + server1 + ".");

            reply = ftp1.getReplyCode();

            if (!FTPReply.isPositiveCompletion(reply))
View Full Code Here

                                           new PrintWriter(System.out)));

        try
        {
            int reply;
            ftp.connect(server);
            System.out.println("Connected to " + server + ".");

            // After connection attempt, you should check the reply code to verify
            // success.
            reply = ftp.getReplyCode();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.