TFtpClient
Last Updated: 11/14/2002

TFtpClient is a FTP client (RFC 959 implementation) based on TWSocket.

Here are the sections available for the TFtpClient:


Below is the full description for all the sections in the TFtpClient:

[Properties]

Below is a list of all Properties for use as a quick reference:

[Back to Main]



Below is a list of all Properties with their complete descriptions:

Timeout: Time to wait in seconds before aborting a command.

property Timeout : Integer;

Unit
FtpCli

Description
Time to wait in seconds during a process before aborting for timeout. The default value is 15 seconds.
[Return to Top]
 
MultiThreaded: Specify if the application is multi-treaded or not.

property MultiThreaded : Boolean;

Unit
FtpCli

Description
Set the multi-threaded property to true if your application is multi-threaded. Leave it to false if not.
[Return to Top]
 
HostName: Identifies the address of the remote computer system.

property HostName : String;

Unit
FtpCli

Description
Host is a string property used to identify the address of the remote computer system. Host and Port are used to identify the endpoint for the transmission.

Host can contain an IP address in dotted-decimal form, such as "120.6.25.142", or a computer name, such as "overbyte.delphicenter.com".

Note: Do not change the HostName when connected.
[Return to Top]
 
Port: Identifies the port number on the remote system.

property Port : String;

Unit
FtpCli

Description
Port is string property used to identify the port number on the remote computer system in Host. Host and Port are used to identify the endpoint for the transmission.

Some protocols, such as FTP, usually have pre-defined port numbers. Port numbers below 1024 are reserved, but using a number above 1024 does not guarantee there will be no conflict.

Note: Do not change the Port when connected.
[Return to Top]
 
LocalAddr: Identifies the address used by the local computer system.

property LocalAddr : String;

Unit
FtpCli

Description
LocalAddress is a read only string property used to identify the address used by the local computer system. Host and Port are used to identify the startpoint for the transmission.

Host can contain an IP address in dotted-decimal form, such as "120.6.25.142", or a computer name, such as "overbyte.delphicenter.com".
[Return to Top]
 
UserName: User name for authentication on FTP server.

property UserName : String;

Unit
FtpCli

Description
[Return to Top]
 
PassWord: Password needed for user login. It can be blank.

property PassWord : String;

Unit
FtpCli

Description
[Return to Top]
 
HostDirName: Directory as know of FTP server.

property HostDirName : String;

Unit
FtpCli

Description
This represents the current directory on the host, the FTP server, for this client.
[Return to Top]
 
HostFileName: File name as known on FTP server.

property HostFileName : String;

Unit
FtpCli

Description
This represents the current filename on the host, the FTP server, for this client.
[Return to Top]
 
LocalFileName: Local file name (complete path.)

property LocalFileName : String;

Unit
FtpCli

Description
This represents the current fully qualified path of the local filename.
[Return to Top]
 
DisplayFileFlag: Specify if the received data should be displayed.

property DisplayFileFlag : Boolean;

Unit
FtpCli

Description
If set to true, the received data will be displayed line by line through the OnDisplayFile event.

Note: A file will not be opened if the DisplayFileFlag property is set to True.
[Return to Top]
 
Binary: Defines if the file transfer should be binary or ascii.

property Binary : Boolean;

Unit
FtpCli

Description
Select binary or ascii file transfert (Need to call TypeSet or TypeSetAsync to send it to FTP server.)
[Return to Top]
 
ErrorMessage: Display the last error message received.

property ErrorMessage : String;

Unit
FtpCli

Description
This read only property gives access to the last error message received.
[Return to Top]
 
ShareMode: Specify the mode that should be used when opening a file.

property ShareMode : TFtpShareMode;
type TFtpShareMode = (ftpShareCompat, ftpShareExclusive, ftpShareDenyWrite, ftpShareDenyRead, ftpShareDenyNone);

Unit
FtpCli

Description
Specify the mode that should be used when opening a file.

Note: A file will not be opened if the DisplayFileFlag property is set to True.
[Return to Top]
 
Options: Specify the way FTP should behave. [incomplete]

property Options : TFtpOptions;
type TFtpOptions = set of TFtpOption;
type TFtpOption = (ftpAcceptLF, ftpNoAutoResumeAt);

Unit
FtpCli

Description
If Options contains ftpAcceptLF, FTP will accept line feed. If Options contains ftpNoAutoResumeAt, the FTP will refuse to resume a download session when aborted.

By default, Options is set to ftpAcceptLF.
[Return to Top]
 
ConnectionType: Specify the type of connection FTP should do.

property ConnectionType : TFtpConnectionType;
type TFtpConnectionType = (ftpDirect, ftpProxy, ftpSocks4, ftpSocks4A, ftpSocks5);

Unit
FtpCli

Description
Set the ConnectionType property to tell FTP how it should connect.

Default value is ftpDirect.

Note: Note.
[Return to Top]
 
ProxyServer: Identifies the address of the proxy server.

property ProxyServer : string;

Unit
FtpCli

Description
ProxyServer is a string property used to identify the address of the proxy server.

ProxyServer can contain an IP address in dotted-decimal form, such as "120.6.25.142", or a computer name, such as "overbyte.delphicenter.com".

How to use a Proxy or Firewall? First of all, not all proxies or firewalls are the same. So have a look at product documentation. However, most products support a transparent proxy which doesn't require any special programming:
  1) Instead of connection to a remote FTP server, you connect to the proxy
  2) User name is replaced by user name, followed by '@' sign then followed by target remote FTP server host name.
  3) Password is usual remote FTP server password.
  4) Most require using Passive mode.

Example: You want to connect to ftp.borland.com, using anonymous connection, company firewall/proxy is running on host named proxyserver.
  FtpCli1.HostName := 'proxyserver';
  FtpCli1.UserName := 'anonymous@ftp.borland.com';
  FtpCli1.Password := 'your.email@company';
  FtpCli1.Passive := TRUE;

Note: This option is used only when ConnectionType is set to ftpProxy.
[Return to Top]
 
SocksPassword: Defines the socket password. [but more...]

property SocksPassword : string;

Unit
FtpCli

Description
[Return to Top]
 
SocksPort: Defines the socket port. [but more...]

property SocksPort : string;

Unit
FtpCli

Description
[Return to Top]
 
SocksServer: Defines the socket server. [but more...]

property SocksServer : string;

Unit
FtpCli

Description
[Return to Top]
 
SocksUserCode: Defines the socket user code. [but more...]

property SocksUserCode : string;

Unit
FtpCli

Description
[Return to Top]
 

[Events]

Below is a list of all Events for use as a quick reference:

[Back to Main]



Below is a list of all Events with their complete descriptions:

OnDisplay: Summary

property OnDisplay : procedure(Sender : TObject; var Msg : String) of object;

Unit
FtpCli

Description
[Return to Top]
 
OnDisplayFile: Display the file data received.

property OnDisplayFile : procedure(Sender : TObject; var Msg : String) of object;

Unit
FtpCli

Description
If the DisplayFileFlag property is set to True, all the file data received will be displayed in the event.

Note: A file will not be opened if the DisplayFileFlag property is set to True.
[Return to Top]
 
OnCommand: Summary

property OnCommand : procedure(Sender : TObject; var Cmd : String) of object;

Unit
FtpCli

Description
[Return to Top]
 
OnResponse: Summary

property OnResponse : TNotifyEvent;

Unit
FtpCli

Description
[Return to Top]
 
OnProgress: Display the current file transfer progression.

property OnProgress : procedure(Sender : TObject; Count : LongInt; var Abort : Boolean) of object;

Unit
FtpCli

Description
[Return to Top]
 
OnSessionConnected: Trigged when the session is connected.

property OnSessionConnected : TSessionConnected;

Unit
FtpCli

Description
[Return to Top]
 
OnSessionClosed: Trigged when the session is closed.

property OnSessionClosed : TSessionClosed;

Unit
FtpCli

Description
[Return to Top]
 
OnRequestDone: Trigged when a command is completed.

property OnRequestDone : procedure(Sender : TObject; RqType : TFtpRequest; Error : Word) of object;

Unit
FtpCli

Description
When an command is completed, this event is called. Use this event to know when an async command is completed and then call the next one.
[Return to Top]
 
OnStateChange: Trigged when the FTP component state changes.

property OnStateChange : TNotifyEvent;

Unit
FtpCli

Description
[Return to Top]
 
OnReadyToTransmit: Trigged when the socket is ready to transmit data.

property OnReadyToTransmit : procedure(Sender : TObject; var bCancel : Boolean) of object;

Unit
FtpCli

Description

Note: If you try to send data when the socket is not ready, it will raise an error.
[Return to Top]
 
OnBgException: Summary

property OnBgException : TBgExceptionEvent;

Unit
FtpCli

Description
[Return to Top]
 

[Methods]

Below is a list of all Methods for use as a quick reference:

[Back to Main]



Below is a list of all Methods with their complete descriptions:

Progress: Summary

function Progress : Boolean; override;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Synchronize: Summary

function Synchronize(Proc : TFtpNextProc) : Boolean; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
WaitUntilReady: Summary

function WaitUntilReady : Boolean; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Create: Summary

constructor Create(AOwner: TComponent); override;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
MessagePump: Summary

procedure MessagePump;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Open: Open the connection with the FTP server.

function Open : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
User: Send username.

function User : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Pass: Send password.

function Pass : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Connect: Open the connection, send username and password.

function Connect : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Cwd: Change Working Directory.

function Cwd : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Pwd: Get current working directory.

function Pwd : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
CDup: Change to parent directory.

function CDup : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
TypeSet: Set type for file transfert.

function TypeSet : Boolean;

Unit
FtpCli

Description


Note: The Binary property is prefered.
[Return to Top]
 
TypeBinary: Set to binary type transfert and call TypeSet.

function TypeBinary : Boolean;

Unit
FtpCli

Description


Note: The Binary property is prefered.
[Return to Top]
 
TypeAscii: Set to ascii type transfert and call TypeSet.

function TypeAscii : Boolean;

Unit
FtpCli

Description


Note: The Binary property is prefered.
[Return to Top]
 
Get: Download a file.

function Get : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Put: Upload a file.

function Put : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestPut: Upload a file, restarting from ResumeAt property value.

function RestPut : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestartPut: Connect, Cwd, Restart uploading a file & Quit.

function RestartPut : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Quit: Disconnect gracefully from FTP server.

function Quit : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Abort: Disconnect (close connection) immediately.

function Abort : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Receive: Connect, Cwd, Download a file & Quit.

function Receive : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Transmit: Connect, Cwd, Upload a file & Quit.

function Transmit : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Append: Upload a file, appending to existing.

function Append : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
AppendFile: Connect, Cwd, Append a file & Quit.

function AppendFile : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Dir: Download a directory listing to a file.

function Dir : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Directory: Connect, Cwd, Download a directory listing to a file & Quit.

function Directory : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Ls: Download a file name listing to a file.

function Ls : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
List: SummaryConnect, Cwd, Download a file name listing to a file & Quit.

function List : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Mkd: Create a directory on the server.

function Mkd : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Mkdir: Connect, Cwd, Create a directory on the server & Quit.

function Mkdir : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Ren: Rename a file or directory on the server.

function Ren : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Rename: Connect, Cwd, Rename a file or directory on the server & Quit.

function Rename : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Dele: Delete a file on the server.

function Dele : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Delete: Connect, Cwd, Delete a file on the server & Quit.

function Delete : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Rmd: Remove a directoy from the server.

function Rmd : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Rmdir: Connect, Cwd, Remove a directoy from the server & Quit.

function Rmdir : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Syst: Get system information from the server.

function Syst : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
System: Connect, Cwd, Get system information from the server & Quit.

function System : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Size: Get file size.

function Size : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
FileSize: Connect, Cwd, get file size & Quit.

function FileSize : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Quote: Send literal command (use LocalFileName as command to send).

function Quote : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
DoQuote: Connect, Cwd, send literal command & Quit.

function DoQuote : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
AbortXfer: SummaryAbort file transfer without disconnecting.

function AbortXfer : Boolean;

Unit
FtpCli

Description


Warning: LocalFilename property is lost after this command.
[Return to Top]
 
RestGet: Download a file, restarting from current local file size.

function RestGet : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestartGet: Connect, Cwd, Restart downloading a file & Quit.

function RestartGet : Boolean;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
Create: Create a new instance of TFtpClient.

constructor Create(AOwner: TComponent); override;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
OpenAsync: Async implementation of Open.

procedure OpenAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
UserAsync: Async implementation of User.

procedure UserAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
PassAsync: Async implementation of Pass.

procedure PassAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ConnectAsync: Async implementation of Connect.

procedure ConnectAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
QuitAsync: Async implementation of Quit.

procedure QuitAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
AbortAsync: Async implementation of Abort.

procedure AbortAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
GetAsync: Async implementation of Get.

procedure GetAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ExecGetAsync: Async implementation of ExecGet.

procedure ExecGetAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ReceiveAsync: Async implementation of Receive.

procedure ReceiveAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
PutAsync: Async implementation of Put.

procedure PutAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ExecPutAsync: Async implementation of ExecPut.

procedure ExecPutAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
TransmitAsync: Async implementation of Transmit.

procedure TransmitAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
AppendAsync: Async implementation of Append.

procedure AppendAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ExecAppendAsync: Async implementation of ExecAppend.

procedure ExecAppendAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
AppendFileAsync: Async implementation of AppendFile.

procedure AppendFileAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ExecDirAsync: Async implementation of ExecDir.

procedure ExecDirAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
DirAsync: Async implementation of Dir.

procedure DirAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ExecLsAsync: Async implementation of ExecLs.

procedure ExecLsAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
LsAsync: Async implementation of Ls.

procedure LsAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
TypeSetAsync: Async implementation of TypeSet.

procedure TypeSetAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
TypeBinaryAsync: Async implementation of TypeBinary.

procedure TypeBinaryAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
TypeAsciiAsync: Async implementation of TypeAscii.

procedure TypeAsciiAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
PwdAsync: Async implementation of Pwd.

procedure PwdAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
CwdAsync: Async implementation of Cwd.

procedure CwdAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
CDupAsync: Async implementation of CDup.

procedure CDupAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
DirectoryAsync: Async implementation of Directory.

procedure DirectoryAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
ListAsync: Async implementation of List.

procedure ListAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
SystAsync: Async implementation of Syst.

procedure SystAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
SystemAsync: Async implementation of System.

procedure SystemAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
SizeAsync: Async implementation of Size.

procedure SizeAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
FileSizeAsync: Async implementation of FileSize.

procedure FileSizeAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
MkdAsync: Async implementation of Mkd.

procedure MkdAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
MkdirAsync: Async implementation of Mkdir.

procedure MkdirAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RmdAsync: Async implementation of Rmd.

procedure RmdAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RmdirAsync: Async implementation of Rmdir.

procedure RmdirAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
DeleAsync: Async implementation of Dele.

procedure DeleAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
DeleteAsync: Async implementation of Delete.

procedure DeleteAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RenFromAsync: Async implementation of RenFrom.

procedure RenFromAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RenToAsync: Async implementation of RenTo.

procedure RenToAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RenAsync: Async implementation of Ren.

procedure RenAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RenameAsync: Async implementation of Rename.

procedure RenameAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
QuoteAsync: Async implementation of Quote.

procedure QuoteAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
DoQuoteAsync: Async implementation of DoQuote.

procedure DoQuoteAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
AbortXferAsync: Async implementation of AbortXfer.

procedure AbortXferAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestAsync: Async implementation of Rest.

procedure RestAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestGetAsync: Async implementation of RestGet.

procedure RestGetAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestartGetAsync: Async implementation of RestartGet.

procedure RestartGetAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestPutAsync: Async implementation of RestPut.

procedure RestPutAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 
RestartPutAsync: Async implementation of RestartPut.

procedure RestartPutAsync; virtual;

Unit
FtpCli

Description


Note: Note.
[Return to Top]
 

[History]

Below is a list of all History for use as a quick reference:

[Back to Main]



Below is a list of all History with their complete descriptions:

11/14/2002: First release by Alexandre Leclerc... only a skelton with the basic definitions of majors parts.
[Return to Top]
 

(There are two set of methods: Async and Sync. The Async are the prefered ones to build robust applications. Their name end with Async like GetAsync)



The ICS FAQ is created and maintained by the ICS VIP Documentation Effort Group.
For more information on how to join our efforts, send email to:
[ICS FAQ]



This page was created by Help-FAQ Builder