Class TFTP4W (unit Ftp4Win)

Inherits from

TComponent

Constructors


constructor Create(AOwner: TComponent);

Calls that will block.


Functions

procedure AbortTransfer;

file related

function CanRestart: boolean;


procedure CDUp;


procedure Connect;

connections

It will free itself


procedure DeleteFile(const AFile: string);


destructor Destroy;

FFirewall := fwNone;

procedure Disconnect;


procedure GetRemoteHelp(const Cmd: string; HelpStrs: TStrings);

misc

procedure Literal(const Cmd: string; Reply: TStrings);


function MakeDir(const ADir: string): string;


procedure RefreshDirectoryList(Filter: string);

directory

procedure RemoveDir(const ADir: string);


procedure RenameFile(const FromName, ToName: string);


procedure Retrieve(const RemoteFile, LocalFile: string; Append: boolean);


procedure RetrieveRestart(const RemoteFile, LocalFile: string; RestartAt: longint);


procedure Send(const RemoteFile, LocalFile: string; Append: boolean);

// FTP4W's implementation of restarted transfers requires a file handled created with // the old Win16 file routines which are not recommeneded under Win32.

procedure SendRestart(const RemoteFile, LocalFile: string; RestartAt: longint);


procedure Connected(Success: boolean);

if FFirewall <> fwNone then LastError := FtpFirewallLogin(PChar(FFirewallHost), PChar(FFirewallUserName), PChar(FFirewallPassword), PChar(FHostName), PChar(FUserName), PChar(FUserPassword), FirewallType(FFirewall), FMsgWnd, WM_FTPMSG_CONNECT) else

procedure DirectoryRefreshed(Success: boolean);


procedure DirectoryStatus(Filename: string);


procedure Disconnected;


procedure MsgWndProc(var Message: TMessage);


procedure RetrieveFinished(Success: boolean);


procedure RetrieveStatus(BytesReceived, BytesRemaining: longint);

// FTP4W's implementation of restarted transfers requires a file handled created with // the old Win16 file routines which are not recommeneded under Win32.

procedure SendFinished(Success: boolean);


procedure SendStatus(BytesReceived, BytesRemaining: longint);


function GetCurrentDirectory: string;


function GetLastErrorStr: string;


function GetLastReply: string;

try

function GetSystemType: string;


procedure SetCurrentDirectory(const Val: string);


procedure SetGotLine(Handler: TFTPGotLine);


procedure SetHostPort(Val: u_short);


procedure SetLastError(Val: integer);


procedure SetLogFileName(const Val: string);


procedure SetLogging(Val: boolean);


procedure SetPassiveMode(Val: boolean);


procedure SetSynchMode(Val: boolean);


procedure SetTimeout(Val: integer);


procedure SetTransferType(Val: TFTPTransferType);

try

procedure SetUseThreading(Val: boolean);


procedure ThreadConnected(Sender: TObject; Success: boolean);


procedure ThreadGetFileFinished(Sender: TObject; Success: boolean);


procedure ThreadSendFileFinished(Sender: TObject; Success: boolean);


procedure ThreadTerminated(Sender: TObject);


Properties

property DirectoryMask : string


property ExtendedDirList : boolean


property HostName : string


property HostPort : u_short


property LogFilename : string


property Logging : boolean


property Timeout : integer


property UserAccount : string


property UserName : string


property UserPassword : string


property UseThreading : boolean


property CurrentDirectory : string


property DirectoryList : TStrings


property IsBusy : boolean


property IsConnected : boolean


property LastError : integer

run-time properties

property LastErrorStr : string


property LastReply : string

read only

property PassiveMode : boolean


property SystemType : string


property TransferType : TFTPTransferType

write only

property MsgWnd : HWND


Events

event OnConnected : TFTPConnected

property Firewall: TFTPFirewall read FFirewall write FFirewall default fwNone; property FirewallHost: string read FFirewallHost write FFirewallHost; property FirewallUserName: string read FFirewallUserName write FFirewallUserName; property FirewallPassword: string read FFirewallPassword write FFirewallPassword;

event OnDirectoryRefreshed : TFTPDirectoryRefreshed


event OnDirectoryStatus : TFTPDirectoryStatus


event OnDisconnected : TFTPDisconnected


event OnGotLine : TFTPGotLine


event OnRetrieveFinished : TFTPRetrieveFinished


event OnRetrieveStatus : TFTPRetrieveStatus


event OnSendFinished : TFTPSendFinished


event OnSendStatus : TFTPSendStatus


Variables

FDirectoryList : TStrings;


FDirectoryMask : string;


FExtendedDirList : boolean;


FHostName : string;


FHostPort : u_short;


FIsBusy : boolean;


FIsConnected : boolean;


FLastError : integer;


FLogFileHandle : HFile;


FLogFileName : string;


FLogging : boolean;


FMsgWnd : HWND;


FOnConnected : TFTPConnected;


FOnDirectoryRefreshed : TFTPDirectoryRefreshed;


FOnDirectoryStatus : TFTPDirectoryStatus;


FOnDisconnected : TFTPDisconnected;


FOnGotLine : TFTPGotLine;


FOnRetrieveFinished : TFTPRetrieveFinished;


FOnRetrieveStatus : TFTPRetrieveStatus;


FOnSendFinished : TFTPSendFinished;


FOnSendStatus : TFTPSendStatus;


FRestartHandle : HFile;


FTimeout : integer;

FFirewall: TFTPFirewall; FFirewallHost: string; FFirewallUserName: string; FFirewallPassword: string;

FTPThread : TFTP4WThread;


FUserAccount : string;


FUserName : string;


FUserPassword : string;


FUseThreading : boolean;



Constructors


constructor Create(AOwner: TComponent);

Calls that will block. FtpAppendToLocalFile FtpAppendToRemoteFile FtpCDUP FtpCloseConnection FtpCWD FtpDeleteFile FtpDir FtpHelp FtpMKD FtpPWD FtpQuote FtpRecvFile FtpRMD FtpSendFile FtpSetPassiveMode FtpSetType FtpSyst these will block, but are not used. FtpOpenConnection FtpSendAccount FtpSendPasswd FtpSendUserName


Functions


procedure AbortTransfer;

file related


function CanRestart: boolean;


procedure CDUp;


procedure Connect;

connections

It will free itself


procedure DeleteFile(const AFile: string);


destructor Destroy;

FFirewall := fwNone;


procedure Disconnect;


procedure GetRemoteHelp(const Cmd: string; HelpStrs: TStrings);

misc


procedure Literal(const Cmd: string; Reply: TStrings);


function MakeDir(const ADir: string): string;


procedure RefreshDirectoryList(Filter: string);

directory


procedure RemoveDir(const ADir: string);


procedure RenameFile(const FromName, ToName: string);


procedure Retrieve(const RemoteFile, LocalFile: string; Append: boolean);


procedure RetrieveRestart(const RemoteFile, LocalFile: string; RestartAt: longint);


procedure Send(const RemoteFile, LocalFile: string; Append: boolean);

// FTP4W's implementation of restarted transfers requires a file handled created with // the old Win16 file routines which are not recommeneded under Win32. Yes, they still // work, but do you want to guess for how long. Instead, we'll do it ourselves manually. LastError := FtpRestart(RestartAt); if FLastError = FTPERR_RESTARTOK then Retrieve(RemoteFile, LocalFile, TRUE);


procedure SendRestart(const RemoteFile, LocalFile: string; RestartAt: longint);


procedure Connected(Success: boolean);

if FFirewall <> fwNone then LastError := FtpFirewallLogin(PChar(FFirewallHost), PChar(FFirewallUserName), PChar(FFirewallPassword), PChar(FHostName), PChar(FUserName), PChar(FUserPassword), FirewallType(FFirewall), FMsgWnd, WM_FTPMSG_CONNECT) else


procedure DirectoryRefreshed(Success: boolean);


procedure DirectoryStatus(Filename: string);


procedure Disconnected;


procedure MsgWndProc(var Message: TMessage);


procedure RetrieveFinished(Success: boolean);


procedure RetrieveStatus(BytesReceived, BytesRemaining: longint);

// FTP4W's implementation of restarted transfers requires a file handled created with // the old Win16 file routines which are not recommeneded under Win32. Yes, they still // work, but do you want to guess for how long. Instead, we'll do it ourselves manually. LastError := FtpRestart(RestartAt); if FLastError = FTPERR_RESTARTOK then Send(RemoteFile, LocalFile, TRUE);


procedure SendFinished(Success: boolean);


procedure SendStatus(BytesReceived, BytesRemaining: longint);


function GetCurrentDirectory: string;


function GetLastErrorStr: string;


function GetLastReply: string;

try


function GetSystemType: string;


procedure SetCurrentDirectory(const Val: string);


procedure SetGotLine(Handler: TFTPGotLine);


procedure SetHostPort(Val: u_short);


procedure SetLastError(Val: integer);


procedure SetLogFileName(const Val: string);


procedure SetLogging(Val: boolean);


procedure SetPassiveMode(Val: boolean);


procedure SetSynchMode(Val: boolean);


procedure SetTimeout(Val: integer);


procedure SetTransferType(Val: TFTPTransferType);

try


procedure SetUseThreading(Val: boolean);


procedure ThreadConnected(Sender: TObject; Success: boolean);


procedure ThreadGetFileFinished(Sender: TObject; Success: boolean);


procedure ThreadSendFileFinished(Sender: TObject; Success: boolean);


procedure ThreadTerminated(Sender: TObject);


Properties


property DirectoryMask : string


property ExtendedDirList : boolean


property HostName : string


property HostPort : u_short


property LogFilename : string


property Logging : boolean


property Timeout : integer


property UserAccount : string


property UserName : string


property UserPassword : string


property UseThreading : boolean


property CurrentDirectory : string


property DirectoryList : TStrings


property IsBusy : boolean


property IsConnected : boolean


property LastError : integer

run-time properties


property LastErrorStr : string


property LastReply : string

read only


property PassiveMode : boolean


property SystemType : string


property TransferType : TFTPTransferType

write only


property MsgWnd : HWND


Events


event OnConnected : TFTPConnected

property Firewall: TFTPFirewall read FFirewall write FFirewall default fwNone; property FirewallHost: string read FFirewallHost write FFirewallHost; property FirewallUserName: string read FFirewallUserName write FFirewallUserName; property FirewallPassword: string read FFirewallPassword write FFirewallPassword;


event OnDirectoryRefreshed : TFTPDirectoryRefreshed


event OnDirectoryStatus : TFTPDirectoryStatus


event OnDisconnected : TFTPDisconnected


event OnGotLine : TFTPGotLine


event OnRetrieveFinished : TFTPRetrieveFinished


event OnRetrieveStatus : TFTPRetrieveStatus


event OnSendFinished : TFTPSendFinished


event OnSendStatus : TFTPSendStatus


Variables


FDirectoryList : TStrings;


FDirectoryMask : string;


FExtendedDirList : boolean;


FHostName : string;


FHostPort : u_short;


FIsBusy : boolean;


FIsConnected : boolean;


FLastError : integer;


FLogFileHandle : HFile;


FLogFileName : string;


FLogging : boolean;


FMsgWnd : HWND;


FOnConnected : TFTPConnected;


FOnDirectoryRefreshed : TFTPDirectoryRefreshed;


FOnDirectoryStatus : TFTPDirectoryStatus;


FOnDisconnected : TFTPDisconnected;


FOnGotLine : TFTPGotLine;


FOnRetrieveFinished : TFTPRetrieveFinished;


FOnRetrieveStatus : TFTPRetrieveStatus;


FOnSendFinished : TFTPSendFinished;


FOnSendStatus : TFTPSendStatus;


FRestartHandle : HFile;


FTimeout : integer;

FFirewall: TFTPFirewall; FFirewallHost: string; FFirewallUserName: string; FFirewallPassword: string;


FTPThread : TFTP4WThread;


FUserAccount : string;


FUserName : string;


FUserPassword : string;


FUseThreading : boolean;