GetFileSize, does it actually work ?

Nov 29, 2012 at 10:55 PM

Trying to use this function to compare file sizes on 2 CDNs, 

 

 

                 long FileSizeDestination = clDestCheck.GetFileSize(VerifyDestinationPath + localfile.Name);
                            long FileSizeSource = cl.GetFileSize(remotePath);

                            //file is found on destination server, check file size match.
                            if (FileSizeDestination == FileSizeSource)
                            {


....

 

In all cases FileSizeDestination and FileSizeSource has a value of 0.

Last time I built was ‎Monday, ‎October ‎29, ‎2012, ‏‎10:35:50 AM.

Coordinator
Nov 29, 2012 at 11:29 PM
Need a transaction log. Refer to the chm docs about debugging the code. There is an example in the source as well.

Sent from my iPhone

On Nov 29, 2012, at 5:55 PM, jasonwitty <notifications@codeplex.com> wrote:

From: jasonwitty

Trying to use this function to compare file sizes on 2 CDNs,

                 long FileSizeDestination = clDestCheck.GetFileSize(VerifyDestinationPath + localfile.Name);
                            long FileSizeSource = cl.GetFileSize(remotePath);

                            //file is found on destination server, check file size match.
                            if (FileSizeDestination == FileSizeSource)
                            {


....

In all cases FileSizeDestination and FileSizeSource has a value of 0.

Last time I built was Monday, October 29, 2012, 10:35:50 AM.

Nov 30, 2012 at 7:21 PM
Edited Nov 30, 2012 at 7:30 PM

I downloaded the newest source to get the debug build to generate the trace listener. Turns out I must be a version behind, there are many changed constructors, properties and events. It will take me a long time to sort through all of these changes. Can you tell me where i can get the latest debug build of version #1?

 

    <Reference Include="System.Net.FtpClient, Version=1.0.4563.38876, Culture=neutral, processorArchitecture=MSIL">      <SpecificVersion>False</SpecificVersion>      <HintPath>ThirdPartyRef\System.Net.FtpClient.dll</HintPath>    </Reference>

Coordinator
Nov 30, 2012 at 7:34 PM
Yep I'm driving right now but I will log in shortly and write up the details.

Sent from my iPhone

On Nov 30, 2012, at 2:21 PM, jasonwitty <notifications@codeplex.com> wrote:

From: jasonwitty

I downloaded the newest source to get the debug build to generate the trace listener. Turns out I must be a version behind, there are many changed constructors, properties and events. It will take me a long time to sort through all of these changes. Can you tell me where i can get the latest debug build of version #1?

Coordinator
Nov 30, 2012 at 8:00 PM
Edited Nov 30, 2012 at 8:06 PM

What you downloaded is a complete re-write and as you've seen is not backwards compatible with the old code base. There is no binary download of the old code but you can go to the Source Code section of this site and select System.Net.FtpClient_1 in the Browsing Changes drop down box. The old code is still supported for bug fixes. Transaction logging is a bit different in the old code base. The FtpClient object should have a FtpLogStream property that you can assign an object that derives from System.IO.Stream to, i.,e, FileStream or Console.OpenStandardOuput(). It's also worth noting that when the old or new code is built with DEBUG defined it should log to the Output window in Visual Studio as well.

What's probably happening here is that the file size isn't being parsed correctly. There is no guarantee that all servers give the same formatting in responses so looking at the transaction log will give us an idea of why it's failing to get the file size. Also, if the data type is set to ASCII instead of Binary, some servers will refuse to give a file size because with ASCII format the server has to actually read the file and calculate the size. NetBSD's FTP daemon is one such example that does this.

Dec 21, 2012 at 1:33 PM

Make sure your you set the connection to binary.

 

 

[code]

cl = new FtpClient();

cl.SetDataType(FtpDataType.Binary);

[/code]