Questions tagged [apache-commons-net]

Apache Commons Net™ library implements the client side of many basic Internet protocols.

Protocols supported:

FTP/FTPS
NNTP
SMTP(S)
POP3(S)
IMAP(S)
Telnet
TFTP
Finger
Whois
rexec/rcmd/rlogin
Time (rdate) and Daytime
Echo
Discard
NTP/SNTP

Refer to https://commons.apache.org/proper/commons-net/ for additional information.

415 questions
27
votes
8 answers

FTPClient - Java, upload file

I'm trying to do a VERY simple file upload. I want a Java FTPClient that can upload any file I tell it to. But the pdf always gets all messed up and my pdf editor (Adobe) won't open it, saying there is an I/O error. I'm using the following class: …
CodeGuy
  • 28,427
  • 76
  • 200
  • 317
27
votes
3 answers

Transfer raw binary with apache commons-net FTPClient?

UPDATE: Solved I was calling FTPClient.setFileType() before I logged in, causing the FTP server to use the default mode (ASCII) no matter what I set it to. The client, on the other hand, was behaving as though the file type had been properly set.…
Chris Suter
  • 1,338
  • 2
  • 9
  • 9
26
votes
4 answers

How to connect to FTPS server with data connection using same TLS session?

Environment: I'm using Sun Java JDK 1.8.0_60 on 64-bit Windows 7, using Spring Integration 4.1.6 (which internally appears to use Apache Commons Net 3.3 for FTPS access). I'm attempting to integrate with our application an automatic download from…
user65839
24
votes
4 answers

Apache Commons FTPClient Hanging

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…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
22
votes
4 answers

Checking file existence on FTP server

Is there an efficient way to check the existence of a file on a FTP server? I'm using Apache Commons Net. I know that I can use the listNames method of FTPClient to get all the files in a specific directory and then I can go over this list to check…
manash
  • 6,985
  • 12
  • 65
  • 125
19
votes
5 answers

FtpClient storeFile always return False

Please figure this out. The code runs properly without any exception. try { FTPClient ftp = new FTPClient(); ftp.connect(server); if(!ftp.login(username, password)) { ftp.logout(); return false; } int reply =…
RaviKiran
  • 585
  • 2
  • 7
  • 16
15
votes
2 answers

Filename encoding in Apache Commons Net FTPClient

I have to upload a file to an FTP server. The filename contains special letters, say äöü. On the FTP server, I need the filename to be UTF-8 encoded. My code is like this: import org.apache.commons.net.ftp.FTPClient; FTPClient client = new…
gefei
  • 18,922
  • 9
  • 50
  • 67
14
votes
4 answers

How to copy a file on the FTP server to a directory on the same server in Java?

I'm using Apache Commons FTP to upload a file. Before uploading I want to check if the file already exists on the server and make a backup from it to a backup directory on the same server. Does anyone know how to copy a file from a FTP server to a…
itro
  • 7,006
  • 27
  • 78
  • 121
12
votes
3 answers

Uploading a file to a FTP server from android phone?

Following is the code that's suppose to create a text document and upload it to my FTP server. For some reason it doesn't seem to work. I used to the libraries provided at…
10
votes
3 answers

FTPClient Uploading File = SocketException: Connection reset

I'm trying to upload a simple txt file via FTP using XAMPP and FileZilla. I'm using the Apache Commons Net 3.0.1 Library. This is my code, very basic things: FTPClient client = new FTPClient(); InputStream in = new ByteArrayInputStream("IT WORKS!…
Oneiros
  • 4,328
  • 6
  • 40
  • 69
10
votes
3 answers

Apache Commons Net FTP is uploading corrupted files

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…
pstanton
  • 35,033
  • 24
  • 126
  • 168
9
votes
3 answers

Apache Commons NET: Should I create a new FTPClient object on each connection or reuse one?

I'm just wondering: in my Java application, each time I need to connect to an FTP server, should I create a new FTPClient object, or should I create one FTPClient() object and re-use that each time I connect to an FTP server?
AlexPriceAP
  • 1,987
  • 6
  • 26
  • 41
9
votes
4 answers

commons-net is compatible with ssh-2.0 protocol

i have tried create a project with library commons.net for send via ftp some files. But i created a connection with my server i have received this error. org.apache.commons.net.MalformedServerReplyException: Could not parse response code. Server…
Nopesound
  • 482
  • 1
  • 13
  • 28
9
votes
4 answers

Setting connect timeout for FtpClient

When using ftpClient.connect with an existing host who has no ftp service active, timeout occurs only after 5 minutes, which is much too long. I tried setting diverse timeouts (setDefaultTimeout, setDataTimeout) which did not change…
stracktracer
  • 1,862
  • 5
  • 24
  • 37
8
votes
3 answers

How to import org.apache.commons.net.ftp.FTPClient

In Eclipse, the following import... import org.apache.commons.net.ftp.FTPClient; ...produces the following error message... The import org.apache cannot be resolved I do not know how to import, nor where to download the import (if necessary). I…
Roger
  • 1,461
  • 5
  • 14
  • 15
1
2 3
27 28