apache-commons-net

Apache Commons Net FTP is uploading corrupted files

╄→гoц情女王★ 提交于 2019-12-18 13:21:19
问题 I'm trying to use Apache Commons Net for FTP file transfers. Problem is files are intermittently arriving at the server corrupt. By 'corrupt' I mean that WinRAR tells me a ZIP file has an 'Unexpected end of archive' . Sometimes the files are completely empty. I have noticed that this happens more for larger files (100kb+), however does happen for small files too (20kb). I know for a fact that the source zip file being uploaded is valid, and is only 243kb. I do not get any errors/exceptions

Apache Commons FTPClient Hanging

拜拜、爱过 提交于 2019-12-18 11:50:28
问题 We are using the following Apache Commons Net FTP code to connect to an FTP server, poll some directories for files, and if files are found, to retrieve them to the local machine: try { logger.trace("Attempting to connect to server..."); // Connect to server FTPClient ftpClient = new FTPClient(); ftpClient.setConnectTimeout(20000); ftpClient.connect("my-server-host-name"); ftpClient.login("myUser", "myPswd"); ftpClient.changeWorkingDirectory("/loadables/"); // Check for failed connection if(

Can the FTP client control FTP server time-out settings?

我是研究僧i 提交于 2019-12-17 16:54:29
问题 I am using Apache Commons-Net library in Java What I want is to set the connection time-out of the FTP-server on the client stage using java-code example : If I look at the FTP server's vsftpd.conf settings file, there is a idle_session_timeout=600 setting I wonder if this idle time-out can be controlled by FTP-client using java code The method below, which I tried but not all worked FTPClient.setControlKeepAliveTimeout(sec); FTPClient.setConnectTimeout(ms); FTPClient.setDataTimeout(ms);

When using Java Apache FTPClient for FTP TLS getting “Remote host closed connection during handshake” [duplicate]

一笑奈何 提交于 2019-12-17 16:42:17
问题 This question already has answers here : How to connect to FTPS server with data connection using same TLS session? (3 answers) Closed last year . I ran a Java (1.8) program on Windows 10 64x for FTP TLS (org.apache.commons.net.ftp): FTPSClient ftpClient = new FTPSClient(); System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2"); // LISTENER ftpClient.addProtocolCommandListener( new PrintCommandListener(new PrintWriter(System.out), true)); ftpClient.connect(server); ftpClient.login

Android FTPClient - retrieveFileStream() always returns null

半世苍凉 提交于 2019-12-12 09:55:20
问题 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

Getting an error while FTP file using FTPClient

人走茶凉 提交于 2019-12-11 03:46:27
问题 I am getting following exception while ftp file over to some other machine. org.apache.commons.net.io.CopyStreamException: IOException caught while copying. at org.apache.commons.net.io.Util.copyStream(Util.java:119) at org.apache.commons.net.io.Util.copyStream(Util.java:151) at org.apache.commons.net.io.Util.copyStream(Util.java:162) at org.apache.commons.net.ftp.FTPClient.__storeFile(FTPClient.java:373) at org.apache.commons.net.ftp.FTPClient.storeFile(FTPClient.java:1360) at com.fs.ftp

Controlled Logging for Apache-commons-net lib (Java)

痞子三分冷 提交于 2019-12-10 13:44:23
问题 I have a very small Java program that is capable of performing FTP over SSL (not SFTP) or FTPS, using apache-commons-net library. The reason why I wrote this program is the client machine is AIX 5.3 which does not support FTP over SSL (OOTB), and the FTP host machine runs FileZilla server with only FTP over SSL enabled. The program runs great without any problem but the amount of logging it generates is huge. My question is- Is there a way to control the amount of logging ? ( Note Again - The

425 Failed to establish connection

蹲街弑〆低调 提交于 2019-12-08 15:05:09
问题 I'm trying to download a file via FTP with a Java application. The FTP url is accessible from this web page: http://professionnels.ign.fr/adminexpress. More specifically, I'm trying to download this file. From my home, I can download the file successfully with my java application, Firefox or Chrome. From my work, I can do the same with Firefox and Chrome only. My application refuses to download anything. NOTA: At work, the browsers and my application use the same HTTP proxy to access internet

Determine the internet time of another country in Java

我是研究僧i 提交于 2019-12-08 10:36:10
问题 I am developing a Java application that will be used by people from around the world. One feature requires it to display the current time in Melbourne, Australia. I have found this answer and adapted the code as follows, but it returns my current time (as expected). It uses the Apache Commons Net library: try { String TIME_SERVER = "time-a.nist.gov"; NTPUDPClient timeClient = new NTPUDPClient(); InetAddress inetAddress = InetAddress.getByName(TIME_SERVER); TimeInfo timeInfo = timeClient

How to get info of an FTPFile

北城余情 提交于 2019-12-08 03:27:53
问题 I am using ApacheCommons to connect to a server and get information of a specific file. I am looking for a method like FTPFile file = ftpclient.getFile(path); or something like this, so I can give it the path of the file and then be able to get info about that file. By info I mean file.getName() or file.lendth() . The only way I found is using listing methods such as listFiles(path) but it requires using for-loop and so on. But is there any better way or more straight forward? 回答1: Use the