aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes SocketException: Software caused connection abort: recv failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "SocketException: Software caused connection abort: recv failed" Watch "SocketException: Software caused connection abort: recv failed" New topic
Author

SocketException: Software caused connection abort: recv failed

Adnan Saleem
Greenhorn

Joined: Nov 30, 2011
Posts: 3
I am making a course project, FTP.

My project works fine in Linux, but same code doesn't works in Windows. error comes in FTP Client Side.

Here is the Output and Stack trace of project.

Trying to connect anonymously to localhost
220 localhost FTP server ready for Client 0.
331 Password required for anonymous.
Successfully logged in!
230 User anonymous logged in.
System type is: UNIX - I mean Java.
215 UNIX - I mean Java.
Current directory is: /
257 /
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
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 java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:154)
at java.io.BufferedReader.readLine(BufferedReader.java:317)
at java.io.BufferedReader.readLine(BufferedReader.java:382)
at ftpclient.FTPConnection.getFullServerReply(FTPConnection.java:425)
at ftpclient.FTPConnection.getServerReply(FTPConnection.java:410)
at ftpclient.FTPConnection.openPort(FTPConnection.java:882)
at ftpclient.FTPConnection.setupDataPort(FTPConnection.java:819)
at ftpclient.FTPConnection.executeDataCommand(FTPConnection.java:760)
at ftpclient.FTPConnection.processFileListCommand(FTPConnection.java:537)
at ftpclient.FTPConnection.getAndParseDirList(FTPConnection.java:571)
at ftpclient.FTPConnection.listFiles(FTPConnection.java:486)
at ftpclient.FTPConnection.listFiles(FTPConnection.java:471)
at ftpclient.TestFTP.main(TestFTP.java:42)

Any help will be appreciated. Thanks!
Adnan Saleem
Greenhorn

Joined: Nov 30, 2011
Posts: 3
Error resolved. Just turn off your firewall! and that will do the work.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Don't turn off your firewall. Instead, add a rule that allows FTP connections. This way you'll still block access you don't want. In other words - don't allow all, only allow what you want.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Adnan Saleem
Greenhorn

Joined: Nov 30, 2011
Posts: 3
Thanks thats a much better option! I'll do that!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SocketException: Software caused connection abort: recv failed