In message <[EMAIL PROTECTED]>, Anil Philip wr ites: >My program is logging into my server and doing an ls >in an almost empty directory. It takes about 10 >seconds. >Contrast this with: I create an .htaccess file in the >same dir so that the dir can be accessed in Internet >Explorer and lists the folder contents. (Options >+Indexes). It takes about 2.5 seconds. >why is commons-net so painfully slow compared with >http for a similar operation? (Is it just the >authentication?)
Presumably you're talking about FTP. FTPClient is far from perfect and its implementation is very dated and inefficient. However, one should always keep in mind that the basic code has been used by innumerable programmers for almost 10 years now, so when you run into an issue like this, it's probably not commons-net, but rather how you're using it. First, establishing a new FTP connection every time you list a directory will always be slower than HTTP. First you have to log in, then you have to establish a data connection for the file listing. The fact that it takes 10 seconds for you has to do with your particular code and runtime environment. Using a modified version of the ftp.java example (so that it will print a listing in addition to performing the file transfer), I can list ftp://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/5/i386/os/ and download ftp://distro.ibiblio.org/pub/linux/distributions/fedora/linux/core/5/i386/os/RPM -GP-KEY in less than a second. And that includes the JVM start up time (I just use /usr/bin/time to time it). Without a precisely specified test case that other people can run to try to reproduce the behavior you are encountering, there's no telling what you are experiencing. daniel --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
