[twsocket] FTP server example error

2016-01-28 Thread Stephen Dickason
(Sorry if this error has been found and fixed, I've looked where I think I 
should and not found it.)
Windows 7 Delphi 2007 for win32 server with custom (non-ICS) FTP client on 
Solaris 10 (Unix).
I'm battling with a problem on the FTP server demo.
>From the client side I'm doing the following:

Login with user and password (230 user logged in)
Change to binary mode (TYPE = I)
Change to passive mode (PASV)
Listing of current directory (NLST and Server logs: Directory 
2.06Mbytes sent in 359 milliseconds)

(The directory has 30k files and growing, but don't believe this is the cause 
of the problem below)
Now here comes the first sign of problem when I retrieve a file:

Change to passive mode (PASV)
Get File filename.ext (RETR and Server logs: filename.ext 2.06Mbytes 
sent in 9 seconds (223Kbytes/sec))

But the filename.ext on disk is not 2.06Mbytes in size but generally less than 
150K.

If I shut down the FTP server demo exe and restart it then rerun the client, 
the filename.ext gets given the right size and everything works fine.  - 
nothing changed except perhaps port numbers assigned by Windows ???
I'm not good at debugging event driven code like this, but think it may be 
OverbyteIcsFtpSrv.TFtpServer.ClientPassiveSessionAvailable not running before 
OverbyteIcsFtpServ1/OverbyteIcsFtpSrv.TMyClient@TFtpCtrlSocket.TriggerDataAvailable
 for some reason.  I've put logging stuff (mORMot synlog style) almost 
everywhere except the twsocket units and can't find the problem - yet.
I thought it was the DataStream and hasopenfile going out of sync, but after 
now handling separately, doesn't seem to be.
Anyone with ideas on how I should proceed further with debugging - what to look 
for?

TIA


Stephen Dickason
Senior Developer - Managed Services
  Email: sdicka...@elcb.co.za

ELCB Information Services (Pty) Ltd
Customer Service Email  e...@elcb.co.za * www.elcb.co.za
E A S T  L O N D O N
Tel: +27(43)  704 0700
Fax: +27(43) 704 0701
J O H A N N E S B U R G
Tel: +27(11) 879 6179
Fax: +27(11) 454 0384
P O R T  E L I Z A B E T H
Tel: +27(41) 373 0529
Fax: +27(86) 650 0135
Disclaimer

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


[twsocket] ICSFTP cannot delete file after successful put. My app is locking the files

2016-01-28 Thread MMG Admin
Hello after successfully uploading the files to a ftp server I'm unable to
delete them. I get error 5, acces denied,

What can I do? Should I use a delay before trying to delete the file?
Thank you!

This is the code that I use:

procedure
incarcare_fisier_pe_ftp_prin_icsftp(nume_fisier,host_ftp,port_ftp,username_ftp,password_ftp,directory_ftp:string;memo_loguri:Tmemo);
var
  icsFtp: TFtpClient;
  nume_fisier_initial,numele_fisierului_redenumit:string;
begin
icsFtp := TFtpclient.Create(nil);
  try

icsFtp.OnProgress64 := form1.icsFtpONProgress;
icsftp.OnDisplay:= form1.DisplayHandler;

icsFtp.HostName := host_ftp;
icsftp.Port:=port_ftp;
icsFtp.UserName := username_ftp;
icsFtp.PassWord := password_ftp;
icsFtp.LocalFileName := nume_fisier;
icsFtp.HostDirName := directory_ftp;
icsFtp.HostFileName := ExtractFileName(icsFtp.LocalFileName);
icsFtp.BandwidthLimit := 0;
icsFtp.Passive := True;
icsFtp.Binary := True;
icsFtp.MultiThreaded := true;

form1.Log('start conectare la "' + icsFtp.HostName+'"');
if not icsFtp.Connect then
begin
  form1.Log('eroare de conectare la "' + icsFtp.HostName + '" => ' +
icsFtp.LastResponse);
  Exit;
end;

try
  form1.Log('conectat cu succes la "' + icsFtp.HostName+'"');

  form1.Log('start incarcare fisier "' + icsFtp.HostFileName + '"');

  if icsftp.cwd then  begin
form1.Log('directorul curent a fost schimbat cu succes in
"'+icsftp.HostDirName+'" => '+icsftp.LastResponse);
end else
  begin
form1.Log('eroare la schimbarea directorului curent
"'+icsftp.HostDirName+'" => '+icsftp.LastResponse);
  end;


  if icsFtp.Put then begin
form1.Log('incarcat cu succes "' + icsFtp.HostFileName + '"');
form1.Log('sterg fisierul "'+icsFtp.HostFileName+ '"');
{sterg fisierul}
if DeleteFile(nume_fisier) then form1.Log('fisierul
"'+nume_fisier+'" a fost STERS')
 else form1.Log('fisierul "'+nume_fisier+'" nu a putut
fi sters => EROARE: '+IntToStr(GetLastError));
  end else begin
form1.Log('eroare la incarcarea fisierului "' + icsFtp.HostFileName
+ '" => ' + icsFtp.LastMultiResponse);
  end;
finally
  form1.Log('inchid conexiunea cu serverul de ftp');
  icsFtp.Quit;
end;
  finally
icsFtp.Free;
  end;
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICSFTP delete file after transfer completed.

2016-01-28 Thread MMG Admin
Thank you for pointing me into the right direction!

2016-01-28 14:09 GMT+02:00 Angus Robertson - Magenta Systems Ltd <
an...@magsys.co.uk>:

> > I want to delete a file after succesfully uploading to ftp.
> > I use overbyteicsftp client and the following code:
> > Is this the correct approach to delete the file after complete
> > transfer to ftp?
>
> > if icsFtp.Put then begin
> >   if DeleteFile(nume_fisier) then
>
> In a crude program, you can get away with this.  But there is a risk
> the FTP server may have reported the upload successful when only a
> partial file was received, or not received atall.
>
> It's much safer to actually check the file exists after being uploaded
> and is the correct size and maybe has not been corrupted during upload,
> perhaps by running a CRC32 or MD5 check.
>
> How you check a file depends on the FTP server functionality, the best
> ways are using the MLST or MDTM commands, but you may need to use LIST
> if these are not supported.
>
> I suggest you look at the FtpCheckFile function in TMagFtp at:
>
> http://www.magsys.co.uk/delphi/magxfer.asp
>
> Or just use that component which has extensive error handling.
>
> Angus
>
>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] ICSFTP delete file after transfer completed.

2016-01-28 Thread MMG Admin
Hello,
I want to delete a file after succesfully uploading to ftp.
I use overbyteicsftp client and the following code:
Is this the correct approach to delete the file after complete transfer to
ftp?
Thank you

begin
icsFtp := TFtpclient.Create(nil);
  try

icsFtp.OnProgress64 := form1.icsFtpONProgress;
icsftp.OnDisplay:= form1.DisplayHandler;

icsFtp.HostName := host_ftp;
icsftp.Port:=port_ftp;
icsFtp.UserName := username_ftp;
icsFtp.PassWord := password_ftp;
icsFtp.LocalFileName := nume_fisier;
icsFtp.HostDirName := directory_ftp;
icsFtp.HostFileName := ExtractFileName(icsFtp.LocalFileName);
icsFtp.BandwidthLimit := 0;
icsFtp.Passive := True;
icsFtp.Binary := True;
icsFtp.MultiThreaded := true;

form1.Log('start conectare la "' + icsFtp.HostName+'"');
if not icsFtp.Connect then
begin
  form1.Log('eroare de conectare la "' + icsFtp.HostName + '" => ' +
icsFtp.LastResponse);
  Exit;
end;

try
  form1.Log('conectat cu succes la "' + icsFtp.HostName+'"');

  form1.Log('start incarcare fisier "' + icsFtp.HostFileName + '"');

  if icsftp.cwd then  begin
form1.Log('directorul curent a fost schimbat cu succes in
"'+icsftp.HostDirName+'" => '+icsftp.LastResponse);
end else
  begin
form1.Log('eroare la schimbarea directorului curent
"'+icsftp.HostDirName+'" => '+icsftp.LastResponse);
  end;


  if icsFtp.Put then begin
form1.Log('incarcat cu succes "' + icsFtp.HostFileName + '"');
form1.Log('sterg fisierul "'+icsFtp.HostFileName+ '"');
{sterg fisierul}
if DeleteFile(nume_fisier) then form1.Log('fisierul
"'+nume_fisier+'" a fost STERS')
 else form1.Log('fisierul "'+nume_fisier+'" nu a putut
fi sters => EROARE: '+IntToStr(GetLastError));
  end else begin
form1.Log('eroare la incarcarea fisierului "' + icsFtp.HostFileName
+ '" => ' + icsFtp.LastMultiResponse);
  end;
finally
  form1.Log('inchid conexiunea cu serverul de ftp');
  icsFtp.Quit;
end;
  finally
icsFtp.Free;
  end;
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server example error

2016-01-28 Thread Angus Robertson - Magenta Systems Ltd
> (Sorry if this error has been found and fixed, I've looked where 
> I think I should and not found it.)
> Windows 7 Delphi 2007 for win32 server with custom (non-ICS) FTP 
> client on Solaris 10 (Unix).
> I'm battling with a problem on the FTP server demo.
>  Get File filename.ext (RETR and Server logs: filename.ext
> 2.06Mbytes sent in 9 seconds (223Kbytes/sec))
> But the filename.ext on disk is not 2.06Mbytes in size but 
> generally less than 150K.

Try repeating your tests against ics.ftptest.org which is one of my
public ICS FTP servers.  Anonymous login is fine for testing downloads.
There are small and large files for different tests.  

I download 200 megs of logs a day from three ICS FTP servers, for
several years, problems are very rare.  

Angus
 

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


[twsocket] Fw: new important message

2016-01-28 Thread Bevan Edwards
Hello!

 

New message, please read 

 

Bevan Edwards

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


Re: [twsocket] ICSFTP cannot delete file after successful put. My app is locking the files

2016-01-28 Thread Angus Robertson - Magenta Systems Ltd
> Hello after successfully uploading the files to a ftp server I'm 
> unable to delete them. I get error 5, acces denied,

This is unrelated to the FTP component.

Angus

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