• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream r

 
Khalid Gul
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys
I am trying to get inputstream from a FTP Link using URL, URLConnection with the following code.

public int FTPCat(String hurl) {
try {
url = new URL(hurl);
br = new BufferedReader(new InputStreamReader(url.openStream()));
System.out.println( "******* DONE *******");
}
}
when I connect to it from the client on our network, it works fine. But I try to it from the server of the network it give me the folloing Exception.

java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
at java.net.SocketInputStream.socketRead(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:86)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:186)
at java.io.BufferedInputStream.read(BufferedInputStream.java:204)
at sun.net.TransferProtocolClient.readServerResponse(TransferProtocolClient.java:52)
at sun.net.ftp.FtpClient.readReply(FtpClient.java:172)
at sun.net.ftp.FtpClient.issueCommand(FtpClient.java:161)
at sun.net.ftp.FtpClient.openDataConnection(FtpClient.java:218)
at sun.net.ftp.FtpClient.get(FtpClient.java:315)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:109)
at java.net.URL.openStream(URL.java:798)

I thought it is because of either any firewall or presence of two network cards on the server which blocks the connection. I have to run this code on server. So plz give me solution because I'm struggling for 2 weeks. Any help will be greatly appreciated.

Khalid
Karachi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!