Daniel, I finallay found the solution. I just removed the enterLocalPassiveMode(), then it works. I think the FTP Server supports the passive mode because I manaully FTP by using passive mode without any problem. Not sure why it does not like the local passive mode in the code. Thanks, Shawn
"Daniel F. Savarese" <[EMAIL PROTECTED]> wrote: In message <[EMAIL PROTECTED]>, shaw shaw writes: > Thank you for your help. I tried to use setDataTimeout and still got time o >ut. I changed the timeout value for both FTPClient.setDataTimeout(timeout) an >d Sorry, it didn't completely register with me that this was a connection timeout. The right way to do set the connection timeout until Commons Net abandons older JVM compatibility is by creating a custom SocketFactory that uses a connection timeout when creating the socket. The data connection in Commons Net 1.4.x uses the socket factory to create the socket for the data connection. Is it possible that the remote server does not support passive mode? Without seeing the code to your socket factory, my guess is the problem is not with Commons Net. Your stack trace produces a ConnectException from Socket.connect from inside of your MySocketFactory.createSocket method. So that indicates that the connection attempt is being made and any failure is outside of the scope of FTPClient, which hands off the connection responsibility to MySocketFactory.createSocket from within FTPClient._openDataConnection_. Maybe print out the arguments that are passed to MySocketFactory.createSocket and make sure they are correct. Is it possible the wrong address is being given? daniel --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------- Looking for last minute shopping deals? Find them fast with Yahoo! Search.