?
Solved

FTP in java

Posted on 2003-02-21
4
Medium Priority
?
306 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 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