I'm trying to use ProFTPClient to download a set of file from an FTP using the following logic. After downloading a file or two, the download fails with andf ArgumentException. I've also had it fail on the first download.
The goal is to ensure we have a local copy of every file in the remote directory. Since I am using a trial version of the API, I'm simulating copying the actual files using a much smaller file in place of the actual files.
ProFTPClient ftp = new ProFTPClient();
ftp.RemoteHost = ConfigurationSettings.AppSettings["FTP.RemoteHost"];
ftp.ControlPort = int.Parse(ConfigurationSettings.AppSettings"FTP.ControlPort"]);
ftp.ClientCertificate = ProFTPCertificate.CreateFromCER_PVK(ConfigurationSettings.AppSettings["FTP.Certificate.CER"], ConfigurationSettings.AppSettings["FTP.Certificate.PVK"], ConfigurationSettings.AppSettings["FTP.Certificate.Password"]);
ftp.ServerValidation = ProFTPClient.ServerValidationType.None;
ftp.Connect();
ftp.Auth(ProFTPClient.SecurityMechanism.TLS, true);
ftp.Login(ConfigurationSettings.AppSettings["FTP.UserName"], ConfigurationSettings.AppSettings["FTP.Password"]);
ftp.DeleteOnFailure = true;
ftp.TransferType = FTPTransferType.ASCII;
ftp.ChDir("Outbound");
foreach(string fileName in ftp.Dir("*.xml", false))
{
if (!File.Exists(fileName))
{
if (File.Exists("file.tmp"))
File.Delete("file.tmp");
ftp.Get("file.tmp", "SmallFile.xml");
File.Move("file.tmp", fileName);
}
}
The program is unable to complete successfully. The program will download a file or two and then terminate with an ArgumentException. There is no pattern as to how many successful downloads occur before encountering this error. And note that all Get() are actually downloading the exact same file.
I've enabled DEBUG logging which results in the following output. In this run, there was one successfully download and on the second Get() the exception was raised.
INFO [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 15 Dec 2004 10:47:43.499 : Licence expiry date: 1/14/2005
INFO [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 15 Dec 2004 10:47:43.499 : Trial license
DEBUG [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 15 Dec 2004 10:47:43.655 : Connecting to ftps.xxxxxx.com:990
DEBUG [EnterpriseDT.Net.Ftp.Pro.ProFTPClient] 15 Dec 2004 10:47:43.655 : ftps.xxxxxx.com resolved to xxx.xxx.xxx.xxx
DEBUG [cl] 15 Dec 2004 10:47:43.671 : Connecting directly to ftp-server xxx.xxx.xxx.xxx:990
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:43.921 : 220-ftps.xxxxxx.com X2 WS_FTP Server 3.00 (3316436403)
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:44.233 : 220-You've connected to Xxxxxxx.Com Secure FTP Site
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:44.233 : 220-at ftps.xxxxxx.com yyy.yyy.yyy.yyy
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:44.233 : 220-The maximum number of users allowed is: 100
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:44.233 : 220-The current number of users is : 3
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:44.296 : 220 ftps.xxxxxx.com X2 WS_FTP Server 3.00 (3316436403)
DEBUG [cl] 15 Dec 2004 10:47:44.296 : Created control-socket: ImplicitFTPS=False, SocksContext=, RemoteHost=0, controlPort=xxx.xxx.xxx.xxx, timeout=990, CompatibilityFlags=0
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:44.312 : ---> AUTH TLS
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:44.921 : 234 SSL enabled and waiting for negotiation
DEBUG [cl] 15 Dec 2004 10:47:44.921 : Beginning d handshake on control-channel. DEBUG [cl] 15 Dec 2004 10:47:45.655 : d handshake complete.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:45.655 : ---> PBSZ 0
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:45.827 : 200 PBSZ=0
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:45.827 : ---> PROT P
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.108 : 200 PRIVATE data channel protection level set
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.171 : ---> USER zzzzzzz
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.312 : 331 Password required
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.312 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.499 : 230-user logged in
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.780 : 230-Welcome zzzzzzz
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.780 : 230 user logged in
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.780 : ---> TYPE A
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.999 : 200 Type set to ASCII.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:46.999 : ---> CWD Outbound
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:47.202 : 250 CWD successful
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:47.202 : ---> PASV
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:47.483 : 227 Entering Passive Mode (xxx,xxx,xxx,xxx,10,114).
DEBUG [cl] 15 Dec 2004 10:47:47.499 : Connecting directly to ftp-server xxx.xxx.xxx.xxx:2674
DEBUG [an] 15 Dec 2004 10:47:47.749 : Created passive data-socket: Protocol=d, SocksConnector=, CompatibilityFlags=0, UseSSLClosure=False, WaitOnClose=False
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:47.749 : ---> NLST *.xml
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:47.952 : 150 Opening ASCII data connection for directory listing
DEBUG [an] 15 Dec 2004 10:47:47.952 : Beginning d handshake on passive data-channel
DEBUG [an] 15 Dec 2004 10:47:49.046 : Handshake complete
DEBUG [an] 15 Dec 2004 10:47:49.780 : Attempt to close unconnected passive data-channel.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:49.874 : 226 transfer complete
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:49.874 : ---> PASV
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:50.046 : 227 Entering Passive Mode (xxx,xxx,xxx,xxx,10,115).
DEBUG [cl] 15 Dec 2004 10:47:50.046 : Connecting directly to ftp-server xxx.xxx.xxx.xxx:2675
DEBUG [an] 15 Dec 2004 10:47:50.265 : Created passive data-socket: Protocol=d, SocksConnector=, CompatibilityFlags=0, UseSSLClosure=False, WaitOnClose=False
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:50.265 : ---> RETR SmallFile.xml
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:50.515 : 150 Opening ASCII data connection for SmallFile.xml (1115 bytes)
DEBUG [an] 15 Dec 2004 10:47:50.530 : Beginning d handshake on passive data-channel
DEBUG [an] 15 Dec 2004 10:47:51.249 : Handshake complete
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 15 Dec 2004 10:47:52.187 : 226 transfer complete
DEBUG [EnterpriseDT.Net.Ftp.FTP