• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

SocketException while using org.apache.commons.net.ftp.FTPClient

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I am using the below program to just list the files

24. FTPClient f = new FTPClient();
25. f.connect("10.0.0.2");//i have ftp server configured at 10.0.0.2 which is a linux machine and i am running the program from windows machine
26. f.login("<<USER>>", "<<PWD>>"); //
27. for (FTPFile kk : f.listFiles()){
28. System.out.println(kk.getName());
29. }
30. f.logout();

And it is returning the below exception


Exception in thread "main" java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
at sun.nio.cs.StreamEncoder.flush(Unknown Source)
at java.io.OutputStreamWriter.flush(Unknown Source)
at java.io.BufferedWriter.flush(Unknown Source)
at org.apache.commons.net.ftp.FTP.__send(FTP.java:501)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:475)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:552)
at org.apache.commons.net.ftp.FTP.port(FTP.java:877)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:709)
at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:657)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3097)
at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3072)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2731)
at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2778)
at com.msat.FTPUtils.main(FTPUtils.java:27)

Please help me in getting rid of the exception.

Thanks in Advance.
 
Rancher
Posts: 1043
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A naive question: did you try it by hand, that is, with the ftp client program?
 
Avinash Haridasu
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, i have posted it here after doing that .
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic