Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

dominick

Posts

11

Joined

Fri Oct 19, 2012 9:46 pm

.Synchronize() uses ASCII transfer mode even for bin-files

by dominick » Tue Jan 06, 2015 3:06 am

Greetings,

I'm using edt ftp net 8.6.1.20 and I'm attempting to sync a trivial .zip file (which contains a single .txt file with contents "123") from the FTP Server (latest filezilla server at the time of this writing) to a local directory. Code:

ftpConnection.ServerAddress = ... ;
ftpConnection.ServerPort = ... ;
ftpConnection.UserName = ... ;
ftpConnection.Password = ... ;
ftpConnection.Timeout = 60000;
ftpConnection.DataEncoding = new System.Text.UTF8Encoding(false);
ftpConnection.CommandEncoding = new System.Text.UTF8Encoding(false);
ftpConnection.ConnectMode = FTPConnectMode.ACTIVE;
ftpConnection.TransferType = FTPTransferType.BINARY; // doesn't really have any effect
ftpConnection.AutoLogin = false; //0
ftpConnection.Connect();
ftpConnection.Login();

FTPSyncRules syncRules = new FTPSyncRules();
syncRules.Direction = TransferDirection.DOWNLOAD;
syncRules.IncludeSubdirectories = true;
syncRules.StopOnError = true;
ftpConnection.Synchronize(@"C:\Path\to\Local\Folder", "/Path/To/Remote/Folder", syncRules);

The above results in a corrupted .zip file which appears to be binary identical to the .zip file we would receive if we attempted to download the file directly by means of .DownloadFile() with TransferMode set to .ASCII.

Can anyone reproduce this issue too? Any insights? I've always thought that edtftp would decide about which transfer mode to use while syncing, on a per-file basis. Thanks in advance.

Cheers,
Dominick

P.S.: I couldn't generate a log-file using edtftp on the testbed machine (this is a separate issue) but I believe that this should be of little consequence.
no avatar
User

dominick

Posts

11

Joined

Fri Oct 19, 2012 9:46 pm

Re: .Synchronize() uses ASCII transfer mode even for bin-fil

by dominick » Wed Jan 07, 2015 10:40 pm

Addendum: My test project is targeting .Net3.5 if that's of any significance.

Any insight as to what might be wrong? Can you guys reproduce this issue?
no avatar
User

dominick

Posts

11

Joined

Fri Oct 19, 2012 9:46 pm

Re: .Synchronize() uses ASCII transfer mode even for bin-fil

by dominick » Sat Jan 10, 2015 12:41 am

Update: It turned out that .Synchronize does respect the .TransferMode value specified afterall (my bad for implying the opposite above). It seems that by default .TransferMode is set to ASCII thus transfering .zip files over by directly invoking .Synchronize() garbles them.

Who is online

Users browsing this forum: No registered users and 19 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron