Recent

Author Topic: FTP and local file compare  (Read 5134 times)

cybersmyth

  • Jr. Member
  • **
  • Posts: 51
FTP and local file compare
« on: March 22, 2011, 12:29:06 pm »
This might be a really dumb question, but I just want to make sure...

I'm working on an FTP client using lNet and want to be sure uploads and downloads complete fully. My thought is to do a FTP listing and compare the file size of the local file to the remote file to verify it uploaded fully.

Is the workable? Are there any situations where a file might have uploaded properly but the directory listing would show a different size than the local file?

Thanks!
-Joe

joseme

  • Full Member
  • ***
  • Posts: 128
    • Logosoft sistemas
Re: FTP and local file compare
« Reply #1 on: March 22, 2011, 06:02:57 pm »
Your proposal is workable, but if you want to cath file corruption I think you can use Ciclic Redundance Check, putting a small text file with the CRC of files to download, and later calculating the CRC for the received files and comparing.
un aporte a la comunidad:
http://pascalylazarus.blogspot.com/

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: FTP and local file compare
« Reply #2 on: March 22, 2011, 09:18:44 pm »
It is possible that there is some difference in filesize counting, but I believe if both are got in bytes it should be ok. CRC is not a bad idea for file upload, although there is no similar possibility to check downloads. And there is always a risk of getting a corrupted download, even when bytesizes are identical (bit flipping errors etc.) and there is no way to check for that.
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

 

TinyPortal © 2005-2018