[DUG] Indy
Robert martin
rob at wildsoft.co.nz
Thu Aug 3 11:53:24 NZST 2006
Hi
I am building a custom FTP server app using Indy 10 components (for the
first time). I am having trouble implementing a crc file verification
system.
On the FTP server I have
procedure TForm1.IdFTPServerCRCFile(ASender: TIdFTPServerContext;
const AFileName: String; var VStream: TStream);
var
CRC : TIdHashCRC32;
fs : TFileStream;
Hash : String;
begin
CRC := TIdHashCRC32.Create;
try
fs := TFileStream.Create(AFilename, fmOpenRead);
try
Hash := IntToStr(CRC.HashValue(fs));
VStream := TMemoryStream.Create;
VStream.Write(Hash, SizeOf(Hash));
finally
fs.Free;
end;
finally
CRC.Free;
end;
The CRC created is correct and if I view (using some extra code) what is
added to the VStream it also is correct. However the value returned to
the client is different and changes between runs. Does anybody have
ideas as to what I am doing wrong?
Note: I believe the VStream is later freed by the component (although I
don't see this documented anywhere).
TIA
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
More information about the Delphi
mailing list