Hello, it's my first post, so if it is wrong place to write I apologize in advance.
I have problem with uploading file to server which I've been trying to solve for few days, but that was been way to nowhere.
Code looks like that, and I am succesfully logging into server, but I can't do anything more.
Java Code:
And I always get errors while uploading, listing files or anything its upsetting-.-"FTPClient client = new FTPClient(); String fileName = "regulamin.txt"; FileInputStream fis = null; int reply; try { fis = new FileInputStream(fileName); client.connect("ftp.polishtennis.web44.net"); System.out.println(client.getReplyString()); reply = client.getReplyCode(); if(!FTPReply.isPositiveCompletion(reply)) { client.disconnect(); System.err.println("FTP server refused connection."); System.exit(1); } client.login("user", "pass"); System.out.print(client.getReplyString()); client.changeWorkingDirectory("/public_html"); System.out.println(client.getReplyString()); client.storeFile("regulamin.txt", fis); System.out.println(client.getReplyString()); client.logout(); System.out.println(client.getReplyString());
//server replies
220---------- Welcome to Pure-FTPd [privsep] ----------
220-You are user number 26 of 500 allowed.
220-Local time is now 05:13. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
230-OK. Current restricted directory is /
230-8 files used (0%) - authorized: 10000 files
230 1687 Kbytes used (0%) - authorized: 1536000 Kb
250 OK. Current directory is /public_html
//exception
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.read(Unknown Source)
at org.apache.commons.net.io.CRLFLineReader.readLine( CRLFLineReader.java:58)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java :310)
at org.apache.commons.net.ftp.FTP.__getReply(FTP.java :290)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.jav a:474)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.jav a:547)
at org.apache.commons.net.ftp.FTP.port(FTP.java:872)
at org.apache.commons.net.ftp.FTPClient._openDataConn ection_(FTPClient.java:667)
at org.apache.commons.net.ftp.FTPClient.__storeFile(F TPClient.java:551)
at org.apache.commons.net.ftp.FTPClient.storeFile(FTP Client.java:1704)
at Socket.main(Socket.java:42)
Am I doing something wrong?
I would be grateful for any help.