apache-commons-net

Fetching last modified date of a file in FTP server using FTPClient.getModificationTime yields null

ε祈祈猫儿з 提交于 2019-12-08 03:02:47
问题 I am trying to fetch last modified date of a file from FTP environment.The result is not as expected. By using ftpClient.getModificationTime("File path") I am getting null . By using FTPFile.getTimestamp().getTime() I am getting wrong last modified (i.e. real last modified is of today and I am getting Wed Feb 18 02:55:22 EST 2004 ). How to get correct last modified?File at FTP Thanks in advance. 回答1: FTPClient.getModificationTime returns null when the server returns an error response to MDTM

SSL Session reuse in Apache FTPS client in JDK 8u161 [duplicate]

爷,独闯天下 提交于 2019-12-07 16:33:09
问题 This question already has answers here : How to connect to FTPS server with data connection using same TLS session? (3 answers) Closed last year . Using Apache Commons-Net's FTPSClient to connect to a modern FTP/S server does not work. The reason is that they require SSL session reuse, i.e. the SSL session from the control connection needs to be re-used for the data connection. This can usually be deactivated in the server, but that is insecure not always an option (since the server might not

How to configure client authentication with apache.commons.net.ftps?

╄→尐↘猪︶ㄣ 提交于 2019-12-07 08:30:52
问题 I implemented a FTPS client (FTP over SSL/TLS) in java using the apache.commons.net -framework. It is configured to do explicit security on the default port 21. ftpsClient = new FTPSClient(false); ftpsClient.setTrustManager(getConfiguration().getCertificatesManager()); ftpsClient.connect(getConfiguration().getHostName(), getConfiguration().getPort()); As long as I don't enforce client-authentication on the server, everything works fine. But I need to enable client-authentication, so I enforce

FTPClient download file failed,the retrieveFile() method replyCode=550

戏子无情 提交于 2019-12-07 06:27:19
问题 /* I run a FTP server on localhost.when I download files use ftpClient.retrieveFile() method,it's replyCode is 550 . I read the API of commons-net and find the 550 replyCode,the defines is" public static final int FILE_UNAVAILABLE 550".but I cannot find the problem from my codes. thanks for your help. */ FTPClient ftpClient = new FTPClient(); FileOutputStream fos = null; try { ftpClient.connect("192.168.1.102",2121); ftpClient.login("myusername", "12345678"); ftpClient.setControlEncoding("UTF

How to download file from FTP using Java?

懵懂的女人 提交于 2019-12-06 14:27:45
问题 With this code iI always get a empty file. What I have to do with it? login is always true . (ofc, here is not real password) import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import java.io.*; public class Logs { public static void main(String[] args) { FTPClient client = new FTPClient(); try { client.connect("myac.cs-server.pro", 121); boolean login = client.login("a3ro", "passWordIsSecret"); System.out.println(login); String remoteFile1 = "myac

Android FTPClient - retrieveFileStream() always returns null

一曲冷凌霜 提交于 2019-12-06 02:37:17
I am a newbie to Android. I am trying download a file from ftp server to sdcard using Apache Commons FTPClient. The line InputStream input = client.retrieveFileStream("/" + fileName); always returns null. But the file is there in Ftp location. Kindly help me to know where the mistake is. I have set the following permissions in my manifest; android:name="android.permission.INTERNET" and android:name="android.permission.WRITE_EXTERNAL_STORAGE" My Code private static void downLoad(){ FTPClient client = new FTPClient(); FileOutputStream fos = null; try { client.connect("ftp.doamin.com"); client

SSL Session reuse in Apache FTPS client in JDK 8u161 [duplicate]

丶灬走出姿态 提交于 2019-12-06 02:04:52
This question already has an answer here: How to connect to FTPS server with data connection using same TLS session? 3 answers Using Apache Commons-Net's FTPSClient to connect to a modern FTP/S server does not work. The reason is that they require SSL session reuse, i.e. the SSL session from the control connection needs to be re-used for the data connection. This can usually be deactivated in the server, but that is insecure not always an option (since the server might not be under your control) The correct solution would be to make the client actually re-use sessions. There is an open bug for

apache-commons ftp retrieve multiple files

南楼画角 提交于 2019-12-06 01:35:43
问题 I'm attempting to use apache-commons net FTP lib to do a get from a FTP server. The code works fine if there's only 1 file in the directory, but always returns null the second time I call retrieveFileStream(). Any thoughts? I've written the following example code to demonstrate my problem. public static void main(String[] args) throws Exception { String strLine; FTPClient client = null; try{ client = new FTPClient(); client.connect("localhost", 21); client.enterLocalPassiveMode(); client

How to configure client authentication with apache.commons.net.ftps?

社会主义新天地 提交于 2019-12-05 15:21:17
I implemented a FTPS client (FTP over SSL/TLS) in java using the apache.commons.net -framework. It is configured to do explicit security on the default port 21. ftpsClient = new FTPSClient(false); ftpsClient.setTrustManager(getConfiguration().getCertificatesManager()); ftpsClient.connect(getConfiguration().getHostName(), getConfiguration().getPort()); As long as I don't enforce client-authentication on the server, everything works fine. But I need to enable client-authentication, so I enforce it on the server and configured the client-system properties: -Djavax.net.ssl.keyStore="D:/.../ftps

FTPClient download file failed,the retrieveFile() method replyCode=550

五迷三道 提交于 2019-12-05 10:43:51
/* I run a FTP server on localhost.when I download files use ftpClient.retrieveFile() method,it's replyCode is 550 . I read the API of commons-net and find the 550 replyCode,the defines is" public static final int FILE_UNAVAILABLE 550".but I cannot find the problem from my codes. thanks for your help. */ FTPClient ftpClient = new FTPClient(); FileOutputStream fos = null; try { ftpClient.connect("192.168.1.102",2121); ftpClient.login("myusername", "12345678"); ftpClient.setControlEncoding("UTF-8"); ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); String remoteFileName = "ftpserver.zip";//this