Package org.apache.commons.net.ftp

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


      return null;
    }
    if (!ftp.login(getUsername(), getPassword())) {
      log.warn("FTP server refused login: {}, user: {}", getIp(),
          getUsername());
      ftp.logout();
      ftp.disconnect();
      return null;
    }
    ftp.setControlEncoding(getEncoding());
    ftp.setFileType(FTP.BINARY_FILE_TYPE);
View Full Code Here


    FTPClient ftp = getClient();
    OutputStream output = new FileOutputStream(file);
    ftp.retrieveFile(getPath() + name, output);
    output.close();
    ftp.logout();
    ftp.disconnect();
    return file;
  }

  public boolean restore(String name, File file) throws IOException {
View Full Code Here

              ftp.changeWorkingDirectory(p);
            }
          }
        }
        ftp.storeFile(name, in);
        ftp.logout();
        ftp.disconnect();
      }
      in.close();
      return 0;
    } catch (SocketException e) {
View Full Code Here

    }

    protected void disconnect(SocketClient client) throws Exception {
        FTPClient ftp = (FTPClient) client;
        if (ftp.isConnected()) {
            ftp.logout();
        }
        super.disconnect(client);
    }

    protected SocketClient createSocketClient() {
View Full Code Here

__main:
        try
        {
            if (!ftp.login(username, password))
            {
                ftp.logout();
                error = true;
                break __main;
            }

            System.out.println("Remote system is " + ftp.getSystemType());
View Full Code Here

                output.close();
            }

            ftp.noop(); // check that control connection is working OK

            ftp.logout();
        }
        catch (FTPConnectionClosedException e)
        {
            error = true;
            System.err.println("Server closed connection.");
View Full Code Here

        {
            try
            {
                if (ftp1.isConnected())
                {
                    ftp1.logout();
                    ftp1.disconnect();
                }
            }
            catch (IOException e)
            {
View Full Code Here

        FTPClient client = null;
        try
        {
            client = connector.createFtpClient(endpoint);
            client.sendNoOp();
            client.logout();
            client.disconnect();

            retryContext.setOk();
        }
        catch (Exception ex)
View Full Code Here

                            {
                                try
                                {
                                    if (!client.completePendingCommand())
                                    {
                                        client.logout();
                                        client.disconnect();
                                        throw new IOException("FTP Stream failed to complete pending request");
                                    }
                                }
                                finally
View Full Code Here

        FTPClient client = null;
        try
        {
            client = connector.createFtpClient(endpoint);
            client.sendNoOp();
            client.logout();
            client.disconnect();

            retryContext.setOk();
        }
        catch (Exception ex)
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.