# Class TFTPSend

Description | Hierarchy | Fields | Methods | Properties

## Unit

ftpsend

## Declaration

`type TFTPSend = class(TSynaClient)`

## Description

Implementation of FTP protocol.

Note: Are you missing properties for setting Username and Password? Look to parent TSynaClient object! (Username and Password have default values for "anonymous" FTP login)

Are you missing properties for specify server address and port? Look to parent TSynaClient too!

## Hierarchy

- TObject
- TSynaClient
- TFTPSend

## Overview

### Fields

| `CustomLogon: TLogonActions;`

### Methods

| `constructor Create;`
| `destructor Destroy; override;`
| `function ReadResult: Integer; virtual;`
| `procedure ParseRemote(Value: string); virtual;`
| `procedure ParseRemoteEPSV(Value: string); virtual;`
| `function FTPCommand(const Value: string): integer; virtual;`
| `function Login: Boolean; virtual;`
| `function Logout: Boolean; virtual;`
| `procedure Abort; virtual;`
| `procedure TelnetAbort; virtual;`
| `function List(Directory: string; NameList: Boolean): Boolean; virtual;`
| `function RetrieveFile(const FileName: string; Restore: Boolean): Boolean; virtual;`
| `function StoreFile(const FileName: string; Restore: Boolean): Boolean; virtual;`
| `function StoreUniqueFile: Boolean; virtual;`
| `function AppendFile(const FileName: string): Boolean; virtual;`
| `function RenameFile(const OldName, NewName: string): Boolean; virtual;`
| `function DeleteFile(const FileName: string): Boolean; virtual;`
| `function FileSize(const FileName: string): int64; virtual;`
| `function NoOp: Boolean; virtual;`
| `function ChangeWorkingDir(const Directory: string): Boolean; virtual;`
| `function ChangeToParentDir: Boolean; virtual;`
| `function ChangeToRootDir: Boolean; virtual;`
| `function DeleteDir(const Directory: string): Boolean; virtual;`
| `function CreateDir(const Directory: string): Boolean; virtual;`
| `function GetCurrentDir: String; virtual;`
| `function DataRead(const DestStream: TStream): Boolean; virtual;`
| `function DataWrite(const SourceStream: TStream): Boolean; virtual;`

### Properties

| `property ResultCode: Integer read FResultCode;`
| `property ResultString: string read FResultString;`
| `property FullResult: TStringList read FFullResult;`
| `property Account: string read FAccount Write FAccount;`
| `property FWHost: string read FFWHost Write FFWHost;`
| `property FWPort: string read FFWPort Write FFWPort;`
| `property FWUsername: string read FFWUsername Write FFWUsername;`
| `property FWPassword: string read FFWPassword Write FFWPassword;`
| `property FWMode: integer read FFWMode Write FFWMode;`
| `property Sock: TTCPBlockSocket read FSock;`
| `property DSock: TTCPBlockSocket read FDSock;`
| `property DataStream: TMemoryStream read FDataStream;`
| `property DataIP: string read FDataIP;`
| `property DataPort: string read FDataPort;`
| `property DirectFile: Boolean read FDirectFile Write FDirectFile;`
| `property DirectFileName: string read FDirectFileName Write FDirectFileName;`
| `property CanResume: Boolean read FCanResume;`
| `property PassiveMode: Boolean read FPassiveMode Write FPassiveMode;`
| `property ForceDefaultPort: Boolean read FForceDefaultPort Write FForceDefaultPort;`
| `property ForceOldPort: Boolean read FForceOldPort Write FForceOldPort;`
| `property OnStatus: TFTPStatus read FOnStatus write FOnStatus;`
| `property FtpList: TFTPList read FFtpList;`
| `property BinaryMode: Boolean read FBinaryMode Write FBinaryMode;`
| `property AutoTLS: Boolean read FAutoTLS Write FAutoTLS;`
| `property FullSSL: Boolean read FFullSSL Write FFullSSL;`
| `property IsTLS: Boolean read FIsTLS;`
| `property IsDataTLS: Boolean read FIsDataTLS;`
| `property TLSonData: Boolean read FTLSonData write FTLSonData;`

## Description

### Fields

| `CustomLogon: TLogonActions;`

Custom definition of login sequence. You can use this when you set FWMode to value -1.

### Methods

| `constructor Create;`

| `destructor Destroy; override;`

| `function ReadResult: Integer; virtual;`

Waits and read FTP server response. You need this only in special cases!

| `procedure ParseRemote(Value: string); virtual;`

Parse remote side information of data channel from value string (returned by PASV command). This function you need only in special cases!

| `procedure ParseRemoteEPSV(Value: string); virtual;`

Parse remote side information of data channel from value string (returned by EPSV command). This function you need only in special cases!

| `function FTPCommand(const Value: string): integer; virtual;`

Send Value as FTP command to FTP server. Returned result code is result of this function. This command is good for sending site specific command, or non-standard commands.

| `function Login: Boolean; virtual;`

Connect and logon to FTP server. If you specify any FireWall, connect to firewall and throw them connect to FTP server. Login sequence depending on FWMode.

| `function Logout: Boolean; virtual;`

Logoff and disconnect from FTP server.

| `procedure Abort; virtual;`

Break current transmission of data. (You can call this method from Sock.OnStatus event, or from another thread.)

| `procedure TelnetAbort; virtual;`

Break current transmission of data. It is same as Abort, but it send abort telnet commands prior ABOR FTP command. Some servers need it. (You can call this method from Sock.OnStatus event, or from another thread.)

| `function List(Directory: string; NameList: Boolean): Boolean; virtual;`

Download directory listing of Directory on FTP server. If Directory is empty string, download listing of current working directory. If NameList is `True`, download only names of files in directory. (internally use NLST command instead LIST command) If NameList is `False`, returned list is also parsed to FtpList property.

| `function RetrieveFile(const FileName: string; Restore: Boolean): Boolean; virtual;`

Read data from FileName on FTP server. If Restore is `True` and server supports resume dowloads, download is resumed. (received is only rest of file)

| `function StoreFile(const FileName: string; Restore: Boolean): Boolean; virtual;`

Send data to FileName on FTP server. If Restore is `True` and server supports resume upload, upload is resumed. (send only rest of file) In this case if remote file is same length as local file, nothing will be done. If remote file is larger then local, resume is disabled and file is transfered from begin!

| `function StoreUniqueFile: Boolean; virtual;`

Send data to FTP server and assing unique name for this file.

| `function AppendFile(const FileName: string): Boolean; virtual;`

Append data to FileName on FTP server.

| `function RenameFile(const OldName, NewName: string): Boolean; virtual;`

Rename on FTP server file with OldName to NewName.

| `function DeleteFile(const FileName: string): Boolean; virtual;`

Delete file FileName on FTP server.

| `function FileSize(const FileName: string): int64; virtual;`

Return size of Filename file on FTP server. If command failed (i.e. not implemented), return -1.

| `function NoOp: Boolean; virtual;`

Send NOOP command to FTP server for preserve of disconnect by inactivity timeout.

| `function ChangeWorkingDir(const Directory: string): Boolean; virtual;`

Change currect working directory to Directory on FTP server.

| `function ChangeToParentDir: Boolean; virtual;`

walk to upper directory on FTP server.

| `function ChangeToRootDir: Boolean; virtual;`

walk to root directory on FTP server. (May not work with all servers properly!)

| `function DeleteDir(const Directory: string): Boolean; virtual;`

Delete Directory on FTP server.

| `function CreateDir(const Directory: string): Boolean; virtual;`

Create Directory on FTP server.

| `function GetCurrentDir: String; virtual;`

Return current working directory on FTP server.

| `function DataRead(const DestStream: TStream): Boolean; virtual;`

Establish data channel to FTP server and retrieve data. This function you need only in special cases, i.e. when you need to implement some special unsupported FTP command!

| `function DataWrite(const SourceStream: TStream): Boolean; virtual;`

Establish data channel to FTP server and send data. This function you need only in special cases, i.e. when you need to implement some special unsupported FTP command.

### Properties

| `property ResultCode: Integer read FResultCode;`

After FTP command contains result number of this operation.

| `property ResultString: string read FResultString;`

After FTP command contains main line of result.

| `property FullResult: TStringList read FFullResult;`

After any FTP command it contains all lines of FTP server reply.

| `property Account: string read FAccount Write FAccount;`

Account information used in some cases inside login sequence.

| `property FWHost: string read FFWHost Write FFWHost;`

Address of firewall. If empty string (default), firewall not used.

| `property FWPort: string read FFWPort Write FFWPort;`

port of firewall. standard value is same port as ftp server used. (21)

| `property FWUsername: string read FFWUsername Write FFWUsername;`

Username for login to firewall. (if needed)

| `property FWPassword: string read FFWPassword Write FFWPassword;`

password for login to firewall. (if needed)

| `property FWMode: integer read FFWMode Write FFWMode;`

Type of Firewall. Used only if you set some firewall address. Supported predefined firewall login sequences are described by comments in source file where you can see pseudocode decribing each sequence.

| `property Sock: TTCPBlockSocket read FSock;`

Socket object used for TCP/IP operation on control channel. Good for seting OnStatus hook, etc.

| `property DSock: TTCPBlockSocket read FDSock;`

Socket object used for TCP/IP operation on data channel. Good for seting OnStatus hook, etc.

| `property DataStream: TMemoryStream read FDataStream;`

If you not use DirectFile mode, all data transfers is made to or from this stream.

| `property DataIP: string read FDataIP;`

After data connection is established, contains remote side IP of this connection.

| `property DataPort: string read FDataPort;`

After data connection is established, contains remote side port of this connection.

| `property DirectFile: Boolean read FDirectFile Write FDirectFile;`

Mode of data handling by data connection. If `False`, all data operations are made to or from DataStream TMemoryStream. If `True`, data operations is made directly to file in your disk. (filename is specified by DirectFileName property.) Dafault is `False`!

| `property DirectFileName: string read FDirectFileName Write FDirectFileName;`

Filename for direct disk data operations.

| `property CanResume: Boolean read FCanResume;`

Indicate after Login if remote server support resume downloads and uploads.

| `property PassiveMode: Boolean read FPassiveMode Write FPassiveMode;`

If true (default value), all transfers is made by passive method. It is safer method for various firewalls.

| `property ForceDefaultPort: Boolean read FForceDefaultPort Write FForceDefaultPort;`

Force to listen for dataconnection on standard port (20). Default is `False`, dataconnections will be made to any non-standard port reported by PORT FTP command. This setting is not used, if you use passive mode.

| `property ForceOldPort: Boolean read FForceOldPort Write FForceOldPort;`

When is `True`, then is disabled EPSV and EPRT support. However without this commands you cannot use IPv6! (Disabling of this commands is needed only when you are behind some crap firewall/NAT.

| `property OnStatus: TFTPStatus read FOnStatus write FOnStatus;`

You may set this hook for monitoring FTP commands and replies.

| `property FtpList: TFTPList read FFtpList;`

After LIST command is here parsed list of files in given directory.

| `property BinaryMode: Boolean read FBinaryMode Write FBinaryMode;`

if `True` (default), then data transfers is in binary mode. If this is set to `False`, then ASCII mode is used.

| `property AutoTLS: Boolean read FAutoTLS Write FAutoTLS;`

if is true, then if server support upgrade to SSL/TLS mode, then use them.

| `property FullSSL: Boolean read FFullSSL Write FFullSSL;`

if server listen on SSL/TLS port, then you set this to true.

| `property IsTLS: Boolean read FIsTLS;`

Signalise, if control channel is in SSL/TLS mode.

| `property IsDataTLS: Boolean read FIsDataTLS;`

Signalise, if data transfers is in SSL/TLS mode.

| `property TLSonData: Boolean read FTLSonData write FTLSonData;`

If `True` (default), then try to use SSL/TLS on data transfers too. If `False`, then SSL/TLS is used only for control connection.

Generated by PasDoc 0.9.0 on 2012-04-23 21:38:50