@Override public boolean login(String username, String password) throws IOException { return client.login(username, password); }
@Override public boolean login(String username, String password, String account) throws IOException { return client.login(username, password, account); }
FTPSClient ftpClient = new FTPSClient(); ftpClient.connect(host); ftpClient.login(user, password);
public static void main(String[] args) { FTPSClient ftp = new FTPSClient(); String host = "server.com"; int port = 2121; String folderName = "dir"; String username = "user"; String password = "password"; try { ftp.connect(host, port); ftp.login(username, password); InputStream fis = new FileInputStream("../filename_src.txt"); ftp.storeFile("/" + folderName + "/filename_dest.xml", fis); fis.close(); ftp.logout(); ftp.disconnect(); } catch (SocketException ex) { Logger.getLogger(FTPSendMessage.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FTPSendMessage.class.getName()).log(Level.SEVERE, null, ex); } }
ftpClient.setSoTimeout(100000); if (ftpClient.login("user", "password")) { ftpClient.execPBSZ(0); ftpClient.execPROT("P");
if(ftpClient.login(username, password))
FTPSClient l_ftp = new FTPSClient("SSL", false); l_ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); l_ftp.setAuthValue("SSL"); l_ftp.connect(l_host, l_port); if (!l_ftp.login(l_username, l_password)) { // BAD! } l_ftp.execPBSZ(0L); l_ftp.execCCC(); l_ftp.pwd(); // DO STUFF l_ftp.logout(); l_ftp.disconnect();
if (!this.ftpsConnection.login(userName, password)) { throw new Exception("Invallid username and/or password. ");
@Override public boolean connectClient() throws IOException { boolean isLoggedIn = true; client.setAutodetectUTF8(true); client.setControlEncoding("UTF-8"); client.connect(host, port); client.setFileType(FTP.BINARY_FILE_TYPE); client.enterLocalPassiveMode(); client.login(username, password); int reply = client.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { client.disconnect(); LogUtils.LOGD(TAG, "Negative reply form FTP server, aborting, id was {}:"+ reply); //throw new IOException("failed to connect to FTP server"); isLoggedIn = false; } return isLoggedIn; }
if (!(ftpsClient.login(user, password))) { LOGGER.error("Could not login to the server"); this.setConnected(false);