festo said:
I am doing a file transfer client server program and I need to be able
to change to a directory on the server to do an "ls" to list the
directory files then transfer file(s) from server to client.
Have you considered using a Java SSH client class to talk to a standard
ftpd or sshd server?
Java class libraries exist to implement the client end of an FTP
connection which would connect to a standard ftpd server and should do
everything you need, though its relatively insecure. See:
http://jakarta.apache.org/commons/net/api/org/apache/commons/net/ftp/FTPClient.html
If you need higher security, e.g. encrypted passwords and files in
transit you should look at SSH. A full SSH implementation supports the
scp facilities for file transfer as well as the sftp facilities which
are a close approximation to FTP in terms of directory listing, moving
around the directory tree and moving files to or from the server, but
encrypt files during transfer. See
http://linuxmafia.com/ssh/java.html
for information on available class libraries.
Using either FTP or SSH will save you a shed load of work because the
servers are standard, tested off the shelf code and have been ported to
almost every OS capable of supporting them.