?
Solved

FTP in java

Posted on 2003-02-21
4
Medium Priority
?
319 Views
Last Modified: 2012-06-27
Hi friends
I am having a problem when i try to connect to a site using my ftp program.Its giving me an error
"java.net.SocketException: Connection reset by peer: Connection reset by peer".
 at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:116)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:404)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:442)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:179)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at FTPConnection.connect(FTPConnection.java:94)
        at FTPConnection.connect(FTPConnection.java:71)
        at FTPConnection.main(FTPConnection.java:757)

I open a socket connection with following code

Socket connectionSocket = new Socket(host, port);
PrintStream   outputStream = new PrintStream(connectionSocket.getOutputStream());
  BufferedReader inputStream = new BufferedReader(new
                       InputStreamReader(connectionSocket.getInputStream()));

When i am trying to logon with its gives me the above mentioned error...


Thanks in advance...
0
Comment
Question by:smakhija
3 Comments
 
LVL 9

Accepted Solution

by:
Venci75 earned 150 total points
ID: 7992352
Probably your implementation of the login is incorrect.
Why don't use the sun.net.www.protocol.ftp.FtpClient class instead of implementing FTP protocol?
0
 

Expert Comment

by:CleanupPing
ID: 9059176
smakhija:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 7

Expert Comment

by:tomboshell
ID: 9582136
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Venci75's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thomas Boshell
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question