Thank you for the reply. Your answer matches our findings. We almost never get the error on the first files but usually in the middle or end. Once we get the error all subsequent attempts result in a failure - it seems after a little of time goes by. Our code FTPs one file at a time and we always instantiate a new FTPConnection object to do that (could that be the cause)? We also use a passive connection mode.
Is there a way to reduce the number of sockets in use? Don't they automatically get released? I've noticed that our socket is always using a different port which is probably why the server runs out the sockets.
We've enabled logging and set the level to ALL. Unfortunately, the logging doesn't show much when the transfer fails.
Here is an excerpt showing a succesful connection followed by 2 failures:
DEBUG [HostNameResolver] 2 Aug 2007 15:44:00.046 : ftp.cdm.com resolved to 63.118.227.180
DEBUG [FTPClient] 2 Aug 2007 15:44:00.046 : Connecting to 63.118.227.180:21
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.109 : 220 CDM FTP Server v1.0 Unathorized Access is Prohibited
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.109 : ---> USER ourusername
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.140 : 331 User name okay, need password.
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.140 : ---> PASS ********
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.171 : 230 User logged in, proceed.
DEBUG [FTPConnection] 2 Aug 2007 15:44:00.171 : Successfully logged in
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.171 : ---> TYPE I
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.203 : 200 Type set to I.
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.203 : ---> PWD
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.234 : 257 "/" is current directory.
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.234 : ---> CWD /
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.265 : 250 Directory changed to /
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.265 : ---> PWD
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.296 : 257 "/" is current directory.
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.296 : ---> MKD PWD Test/PWD Import Status
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.328 : 550 /PWD Test/PWD Import Status: Failed to create.
INFO [FTPControlSocket] 2 Aug 2007 15:44:00.328 : Expected reply codes = [200,250,257]
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.328 : ---> CWD PWD Test/PWD Import Status
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.359 : 250 Directory changed to /PWD Test/PWD Import Status
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.359 : ---> PWD
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.390 : 257 "/PWD Test/PWD Import Status" is current directory.
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.406 : ---> PASV
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.437 : 227 Entering Passive Mode (63,118,227,180,15,224)
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.437 : Server supplied address=63.118.227.180
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.437 : Server supplied port=4064
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.437 : Substituting server supplied IP (63.118.227.180) with remote host IP (63.118.227.180)
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.437 : NewPassiveDataSocket(63.118.227.180,4064)
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.468 : ---> STOR IMG_0702.JPG
DEBUG [FTPControlSocket] 2 Aug 2007 15:44:00.500 : 150 Opening BINARY mode data connection for IMG_0702.JPG.
DEBUG [FTPClient] 2 Aug 2007 15:45:27.671 : Transferred 3688923 bytes to remote host
DEBUG [FTPControlSocket] 2 Aug 2007 15:45:27.812 : 226-Maximum disk quota limited to 3072000 kBytes
DEBUG [FTPControlSocket] 2 Aug 2007 15:45:28.015 : Used disk quota 1907171 kBytes, available 1164828 kBytes
DEBUG [FTPControlSocket] 2 Aug 2007 15:45:28.015 : 226 Transfer complete.
DEBUG [FTPControlSocket] 2 Aug 2007 15:45:28.015 : ---> QUIT
DEBUG [FTPControlSocket] 2 Aug 2007 15:45:28.046 : 221 Goodbye!
DEBUG [HostNameResolver] 2 Aug 2007 15:45:28.046 : ftp.cdm.com resolved to 63.118.227.180
DEBUG [FTPClient] 2 Aug 2007 15:45:28.046 : Connecting to 63.118.227.180:21
DEBUG [HostNameResolver] 2 Aug 2007 15:45:28.625 : ftp.cdm.com resolved to 63.118.227.180
DEBUG [FTPClient] 2 Aug 2007 15:45:28.625 : Connecting to 63.118.227.180:21
Thank you,
Michael Tzoanos