Re: [twsocket] Ftp-file corruption check

2007-09-23 Thread New Era
thanks for your kind reply,

but if I go with the stable version of the ICS which does not have XCRC command 
support,  I used the following code to achieve my aim
(recommended by FPiette),

1- upload file using ftpPutAsync()
2- use ftpDirAsync() and check the size of the file of interest if it is same 
on the local machine and on the remote machine.

I used the following pseudo code:

procedure ftpRequestDone();
begin
   
case RqType of

ftpTypeSetAsync(): Begin
  ftpCli.HostFileName:= '2.bin';
  ftpCli.LocalFileName:= 'c:\2.bin';
  ftpCli.HostDirName:= '/';
  .
  ftpCli.PutAsync();
End;

ftpPutAsync: Begin
  ftpCli.HostFileName:= '2.bin';
  ftpCli.LocalFileName:= '';
  ftpCli.HostDirName:= '/';
  ftpCli.LocalStream:= TMemoryStream.Create();
  ftpCli.DirAsync();
End;
 
ftpDirAsync: Begin 
  ftpCli.LocalStream.Position:= 0;
  SetLength(tempStr, ftpCli.LocalStream.Size);
  {Get the directory response of the server into tempStr 
string.}
  CopyMemory(Pointer(tempStr)^,  
TMemoryStream(ftpCli.LocalStream).Memory, ftpCli.LocalStream.Size);
 
  if(Pos(FileSizeInString, tempStr)0) then 
ShowMessage('Uploaded Correctly')
  else showMessage('upload failure');
End;
... 
   
 
end;

end;

but the problem with this code is; the server returns the whole directory 
content (losts of file) but I only want to get the directory 
listing for the specified file, to do that I used ftpCli.HostFileName:= 
'2.bin'; before calling ftpcli.DirAsync() but it did not work.
Is there anyway to get the directory listing for the only specified file?

best regards,
Thanks


Arno Garrels [EMAIL PROTECTED] wrote: New Era wrote:
 How to check if a file is either uploaded correctly or not, I know
 that ftpCli supports MD5 command, but at the outside world there were
 no commercial ftp hosting services that support MD5 command, I only
 found one ftp hosting which supports XCRC and this is command as far
 as I know, is not supported by ftpCli. (I am trying to build an ftp
 client that is to be used to upload files to external ftp host.)

Aug 06, 2006 V2.107 Angus [SNIP]
 added XCRC command to get CRC32 for file (for servers without MD5)

So get latest ICS-Beta, it's in both V5 and V6

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html 
 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


   
-
 Yahoo! Answers - Get better answers from someone who knows. Tryit now.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Ftp-file corruption check

2007-09-23 Thread Francois PIETTE
If you want ot get directory listing to get the file size, you are on the 
wrong track. FTP has a sie command to get the size of a file. Use it.

Now if you really want to dir list for a file only, most FTP server use the 
host file name as filter.

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

- Original Message - 
From: New Era [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Sunday, September 23, 2007 8:57 AM
Subject: Re: [twsocket] Ftp-file corruption check


 thanks for your kind reply,

 but if I go with the stable version of the ICS which does not have XCRC 
 command support,  I used the following code to achieve my aim
 (recommended by FPiette),

 1- upload file using ftpPutAsync()
 2- use ftpDirAsync() and check the size of the file of interest if it is 
 same on the local machine and on the remote machine.

 I used the following pseudo code:

 procedure ftpRequestDone();
 begin

case RqType of

ftpTypeSetAsync(): Begin
  ftpCli.HostFileName:= '2.bin';
  ftpCli.LocalFileName:= 'c:\2.bin';
  ftpCli.HostDirName:= '/';
  .
  ftpCli.PutAsync();
End;

ftpPutAsync: Begin
  ftpCli.HostFileName:= '2.bin';
  ftpCli.LocalFileName:= '';
  ftpCli.HostDirName:= '/';
  ftpCli.LocalStream:= TMemoryStream.Create();
  ftpCli.DirAsync();
End;

ftpDirAsync: Begin
  ftpCli.LocalStream.Position:= 0;
  SetLength(tempStr, ftpCli.LocalStream.Size);
  {Get the directory response of the server into 
 tempStr string.}
  CopyMemory(Pointer(tempStr)^, 
 TMemoryStream(ftpCli.LocalStream).Memory, ftpCli.LocalStream.Size);

  if(Pos(FileSizeInString, tempStr)0) then 
 ShowMessage('Uploaded Correctly')
  else showMessage('upload failure');
End;
...


end;

 end;

 but the problem with this code is; the server returns the whole directory 
 content (losts of file) but I only want to get the directory
 listing for the specified file, to do that I used ftpCli.HostFileName:= 
 '2.bin'; before calling ftpcli.DirAsync() but it did not work.
 Is there anyway to get the directory listing for the only specified file?

 best regards,
 Thanks


 Arno Garrels [EMAIL PROTECTED] wrote: New Era wrote:
 How to check if a file is either uploaded correctly or not, I know
 that ftpCli supports MD5 command, but at the outside world there were
 no commercial ftp hosting services that support MD5 command, I only
 found one ftp hosting which supports XCRC and this is command as far
 as I know, is not supported by ftpCli. (I am trying to build an ftp
 client that is to be used to upload files to external ftp host.)

 Aug 06, 2006 V2.107 Angus [SNIP]
 added XCRC command to get CRC32 for file (for servers without 
 MD5)

 So get latest ICS-Beta, it's in both V5 and V6

 --
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html

 -- 
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://www.elists.org/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be



 -
 Yahoo! Answers - Get better answers from someone who knows. Tryit now.
 -- 
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://www.elists.org/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be