File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing FTP Server using Java

 
Chetan Parekh
Ranch Hand
Posts: 3640
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!,

I downloaded following class from the net that allows to login in FTP Server.

It was working fine, but when I added ls command (I have added comment see that) , it give error saying [i]500 'LS': command not understood.[i]

How to solve this problem?

Reg,
Chetan
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FTP is a pretty loose protocol. Some servers implement features that others do not. Depending on your server, "LS" may not be supported:

5. DECLARATIVE SPECIFICATIONS

5.1. MINIMUM IMPLEMENTATION

In order to make FTP workable without needless error messages, the
following minimum implementation is required for all servers:

TYPE - ASCII Non-print
MODE - Stream
STRUCTURE - File, Record
COMMANDS - USER, QUIT, PORT,
TYPE, MODE, STRU,
for the default values
RETR, STOR,
NOOP.

The default values for transfer parameters are:

TYPE - ASCII Non-print
MODE - Stream
STRU - File

All hosts must accept the above as the standard defaults.

RFC 959 - File Transfer Protocol
As a matter of fact, I don't see "LS" at all in the RFC.
Try using a command-line FTP client to log in. Typing in "help" may get you a list of valid commands for that server.
 
Arnold Reuser
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you could take also look at Commons Net for the base classes of FTP.
Around these bases classes Julian Robichaux has already written a wrapper that make the usage of FTP within java a bit less hard. You can find his code over here : http://www.nsftools.com/tips/JakartaFtpWrapper.java
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!!

I will implement this thing.

Warm Regards,
Chetan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic