FTP - das geht
imho am besten mit
Indy.
Um die
Ftp-Befehle ausgeben zu lassen, habe ich mir folgende Kompo gecodet:
Delphi-Quellcode:
type
TEventType = (etCommand, etResponse);
TEvent = procedure (const EventText: String; EventType: TEventType) of object;
TLogIdFtp = class (TIdFtp)
private
FEvent: TEvent;
public
procedure Write (const AOut: string = ''); override;
function ReadLn(ATerminator: string = LF;
const ATimeout: Integer = IdTimeoutDefault; AMaxLineLength: Integer = -1): string; override;
published
property OnEvent: TEvent read FEvent write FEvent;
end;
implementation
function TLogIdFtp.ReadLn(ATerminator: string = LF;
const ATimeout: Integer = IdTimeoutDefault; AMaxLineLength: Integer = -1): string;
begin
Result := inherited ReadLn (ATerminator, ATimeout, AMaxLineLength);
if Assigned (OnEvent) then
FEvent (Trim (Result), etResponse);
end;
procedure TLogIdFtp.Write (const AOut: string);
begin
inherited;
if Assigned (OnEvent) then
FEvent (Trim (AOut), etCommand);
end;