Package org.apache.commons.net.ftp

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


     
      /*
       *  En el modo pasivo es siempre el cliente quien abre las conexiones
       *  Da menos problemas si estamos detr�s de un firewall, por ejemplo
       */
      clienteFtp.enterLocalPassiveMode();
      clienteFtp.setFileType(FTPClient.BINARY_FILE_TYPE);
     
      // Lista el directorio del servidor FTP
      System.out.println("Listando el directorio ra�z del servidor . . ");
      FTPFile[] ficheros = clienteFtp.listFiles();
View Full Code Here


    if (!FTPReply.isPositiveCompletion( ftpClient.getReplyCode() )) {
      ftpClient.disconnect();
      throw new RuntimeException( String.format( "% refused connection.", this.hostname ) );
    }
    ftpClient.login( username, password );
    ftpClient.enterLocalPassiveMode();
    return ftpClient;
  }

  public void disconnect( FTPClient ftpClient ) throws IOException {
    if (ftpClient != null) {
View Full Code Here

                }
            }

            if (passive) {
                log("entering passive mode", Project.MSG_VERBOSE);
                ftp.enterLocalPassiveMode();
                if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
                    throw new BuildException("could not enter into passive "
                                             + "mode: " + ftp.getReplyString());
                }
            }
View Full Code Here

                }
            }

            if (passive) {
                log("entering passive mode", Project.MSG_VERBOSE);
                ftp.enterLocalPassiveMode();
                if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
                    throw new BuildException("could not enter into passive "
                         + "mode: " + ftp.getReplyString());
                }
            }
View Full Code Here

    if (file.length() > connectionManager.getConfig().getFtpFileSize()) {
      FTPClient ftp = null;
      try {
        ftp = connectionManager.getFTP();
        ftp.cwd(connectionManager.getConfig().getFtpDir());
        ftp.enterLocalPassiveMode();
        if (!ftp.storeFile(file.getName(), new FileInputStream(file))) {
          throw new FTPException("Error during FTP store file.");
        }

      } finally {
View Full Code Here

            if (binaryTransfer)
                ftp.setFileType(FTP.BINARY_FILE_TYPE);

            // Use passive mode as default because most of us are
            // behind firewalls these days.
            ftp.enterLocalPassiveMode();

            if (storeFile)
            {
                InputStream input;
View Full Code Here

                }
            }

            if (task.isPassive()) {
                task.log("entering passive mode", Project.MSG_VERBOSE);
                ftp.enterLocalPassiveMode();
                if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
                    throw new BuildException("could not enter into passive "
                                             + "mode: " + ftp.getReplyString());
                }
            }
View Full Code Here

                }
            }

            if (passive) {
                log("entering passive mode", Project.MSG_VERBOSE);
                ftp.enterLocalPassiveMode();
                if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
                    throw new BuildException("could not enter into passive "
                                             + "mode: " + ftp.getReplyString());
                }
            }
View Full Code Here

      if (! FTPReply.isPositiveCompletion(reply)) {
        close();
        throw new RuntimeException("FTP server refused connection.");
      }
     
      ftpClient.enterLocalPassiveMode(); //可解决部分FTP传输不稳定的问题
      if (! ftpClient.setFileType(FTP.BINARY_FILE_TYPE)) {
        close();
        throw new RuntimeException("FTP server refused setFileType.");
      }
    } catch (SocketException e) {
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.