Hi,

I'm using your batchtransfer sample to download a directory tree from FTP (using Getfiles). The files on the FTP can be rather large (>1GB) so I don't want to download them when they are already locally available. I do however need to check if we're talking about the same file so I need to calculate a checksum of both the local and remote file.

I implemented this check in the BatchTransferProblemDetected event handler. In there I call the GetRemoteChecksum function and that's where it's going wrong. When the app executes this function I get the error "Another operation is pending". When I disable this function the rest of the app runs smoothly.

It seems that the component is not able to run GetRemoteChecksum while it's busy. Is this by design? Any suggestion how to get this working?

Thanks,

Johan

asked 18 Jan, 09:26

Sparkling's gravatar image

Sparkling
251
accept rate: 0%


Hello,

when using Ftp one operation can be executed at a time only. Therefore calling the GetRemoteChecksum method when a batch operation is in progress throws the mentioned exception.

We are currently finishing new version of components. When it is released we add new value OverwriteIfChecksumDiffers to the BatchAction enumeration.

In the meantime, you can use following algorithm:

  • Start a batch operation.
  • If the file already exists store the local and remote path into a collection (you can use List<BatchProblemDetectedEventArgs> the event args contains both).
  • When the batch operation finish iterate through the collection and compute desired checksums.
  • If the checksums differ transfer the file immediately using a single file transfer method.

If you want the sample code, please leave the comment.

link

answered 18 Jan, 16:33

Lukas%20Matyska's gravatar image

Lukas Matyska ♦♦
78217
accept rate: 27%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×10

Asked: 18 Jan, 09:26

Seen: 41 times

Last updated: 18 Jan, 16:33