I got this issue that is bothering me for a week now,
I'm trying to upload a file xml with ftp using java, nothing too fancy.
After a few web serch i decided to use the ftp4j pack wich, according to the documentation should do the trick.
Point is that this ftp server actually work with Filezilla...
these are a few line of my code:
public void connect() {
try {
String[] con = client.connect(s);
for (int i = 0; i < con.length; i++) {
System.out.println(con[i]);
}
client.login(user, password);
s = client.getHost();
System.out.println(s);
con = client.help();
for (int i = 0; i < con.length; i++) {
System.out.println(con[i]);
}
client.changeDirectory(sDir);
s = client.currentDirectory();
System.setProperty("ftp4j.passiveDataTransfer.useSuggestedAddress", "1");
client.setPassive(true);
System.out.println(client.isPassive());
client.setType(FTPClient.TYPE_BINARY);
client.upload(file);
} catch (Exception ex) {
Logger.getLogger(ftpConnector.class.getName()).log(Level.SEVERE, null, ex);
System.out.println(ex.toString());
}
}
well i get this output:
*
*
* Aruba.it
# The Web Hosting Company
#
#
This is a private system - No anonymous login
ftp.open-eye.it
The following SITE commands are recognized
CHMOD
IDLE
UTIME
Pure-FTPd - http://pureftpd.org/
true
[code=200, message=TYPE is now ASCII]
java.net.SocketException: Connection reset
I'm pretty sure the Connection reset is related to the upload command i give with client.upload(file);
all my vars are declared on an upper level.
ava.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at sun.nio.cs.StreamDecoder.read0(StreamDecoder.java:126)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:112)
at java.io.InputStreamReader.read(InputStreamReader.java:168)
at it.sauronsoftware.ftp4j.NVTASCIIReader.readLine(NVTASCIIReader.java:105)
at it.sauronsoftware.ftp4j.FTPCommunicationChannel.read(FTPCommunicationChannel.java:142)
at it.sauronsoftware.ftp4j.FTPCommunicationChannel.readFTPReply(FTPCommunicationChannel.java:187)
at it.sauronsoftware.ftp4j.FTPClient.openPassiveDataTransferChannel(FTPClient.java:3534)
at it.sauronsoftware.ftp4j.FTPClient.openDataTransferChannel(FTPClient.java:3468)
at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3297)
at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3208)
at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3073)
Thanks for your time, Francesco.