Package org.apache.commons.net

Examples of org.apache.commons.net.PrintCommandListener


            ftp.setControlKeepAliveReplyTimeout(controlKeepAliveReplyTimeout);
        }
        ftp.setListHiddenFiles(hidden);

        // suppress login details
        ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));

        try
        {
            int reply;
            if (port > 0) {
View Full Code Here


    private PrintWriter out;

    private boolean open(String host, int port) throws Exception{
        System.out.println("Connecting to "+host);
        out = new PrintWriter(new FileWriter(new File(DOWNLOAD_DIR, host+"_info.txt")));
        listener = new PrintCommandListener(out);
        addProtocolCommandListener(listener);
        setConnectTimeout(30000);
        try {
            connect(host, port);
        } catch (Exception e) {
View Full Code Here

        String path;// = "/";

        new File(DOWNLOAD_DIR).mkdirs();
        DownloadListings self = new DownloadListings();
        OutputStream os = new FileOutputStream(new File(DOWNLOAD_DIR, "session.log"));
        self.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(os), true));

        Reader is = new FileReader("mirrors.list");
        BufferedReader rdr = new BufferedReader(is);
        String line;
        while((line=rdr.readLine()) != null){
View Full Code Here

      FTPClientConfig config = new FTPClientConfig(FTPClientConfig.SYST_MVS);
      ftp.configure(config);

      if (conf.getBoolean(JobBase.PROPERTY_VERBOSE, false)) {
        ftp.addProtocolCommandListener(new PrintCommandListener(
            new PrintWriter(System.out), true));
      }
      try {
        if (port > 0) {
          ftp.connect(server, port);
View Full Code Here

        String hostname = args[0];
        String newsgroup = args[1];

        NNTPClient client = new NNTPClient();
        client.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));
        client.connect(hostname);

        if (args.length == 4) { // Optional auth
            String user = args[2];
            String password = args[3];
View Full Code Here

                System.err.println("File not found. " + e.getMessage());
                System.exit(1);
            }

            client = new NNTPClient();
            client.addProtocolCommandListener(new PrintCommandListener(
                                                  new PrintWriter(System.out), true));

            client.connect(server);

            if (!NNTPReply.isPositiveCompletion(client.getReplyCode()))
View Full Code Here

            {
                System.err.println("File not found. " + e.getMessage());
            }

            client = new SMTPClient();
            client.addProtocolCommandListener(new PrintCommandListener(
                                                  new PrintWriter(System.out), true));

            client.connect(server);

            if (!SMTPReply.isPositiveCompletion(client.getReplyCode()))
View Full Code Here

            ftp.setControlKeepAliveReplyTimeout(controlKeepAliveReplyTimeout);
        }
        ftp.setListHiddenFiles(hidden);

        // suppress login details
        ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true));

        try
        {
            int reply;
            if (port > 0) {
View Full Code Here

    }
  }

  private FTPClient getClient() throws SocketException, IOException {
    FTPClient ftp = new FTPClient();
    ftp.addProtocolCommandListener(new PrintCommandListener(
        new PrintWriter(System.out)));
    ftp.setDefaultPort(getPort());
    ftp.connect(getIp());
    int reply = ftp.getReplyCode();
    if (!FTPReply.isPositiveCompletion(reply)) {
View Full Code Here

    private PrintWriter out;

    private boolean open(String host, int port) throws Exception{
        System.out.println("Connecting to "+host);
        out = new PrintWriter(new FileWriter(new File(DOWNLOAD_DIR, host+"_info.txt")));
        listener = new PrintCommandListener(out);
        addProtocolCommandListener(listener);
        setConnectTimeout(30000);
        try {
            connect(host, port);
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.commons.net.PrintCommandListener

Copyright © 2018 www.massapicom. 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.