Class TFTPSend

DescriptionHierarchyFieldsMethodsProperties

Unit

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

Overview

Fields

Public CustomLogon: TLogonActions;

Methods

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

Properties

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

Description

Fields

Public CustomLogon: TLogonActions;

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

Methods

Public constructor Create;
 
Public destructor Destroy; override;
 
Public function ReadResult: Integer; virtual;

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

Public 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!

Public 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!

Public 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.

Public 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.

Public function Logout: Boolean; virtual;

Logoff and disconnect from FTP server.

Public procedure Abort; virtual;

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

Public 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.)

Public 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.

Public 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)

Public 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!

Public function StoreUniqueFile: Boolean; virtual;

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

Public function AppendFile(const FileName: string): Boolean; virtual;

Append data to FileName on FTP server.

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

Rename on FTP server file with OldName to NewName.

Public function DeleteFile(const FileName: string): Boolean; virtual;

Delete file FileName on FTP server.

Public function FileSize(const FileName: string): int64; virtual;

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

Public function NoOp: Boolean; virtual;

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

Public function ChangeWorkingDir(const Directory: string): Boolean; virtual;

Change currect working directory to Directory on FTP server.

Public function ChangeToParentDir: Boolean; virtual;

walk to upper directory on FTP server.

Public function ChangeToRootDir: Boolean; virtual;

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

Public function DeleteDir(const Directory: string): Boolean; virtual;

Delete Directory on FTP server.

Public function CreateDir(const Directory: string): Boolean; virtual;

Create Directory on FTP server.

Public function GetCurrentDir: String; virtual;

Return current working directory on FTP server.

Public 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!

Public 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

Published property ResultCode: Integer read FResultCode;

After FTP command contains result number of this operation.

Published property ResultString: string read FResultString;

After FTP command contains main line of result.

Published property FullResult: TStringList read FFullResult;

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

Published property Account: string read FAccount Write FAccount;

Account information used in some cases inside login sequence.

Published property FWHost: string read FFWHost Write FFWHost;

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

Published property FWPort: string read FFWPort Write FFWPort;

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

Published property FWUsername: string read FFWUsername Write FFWUsername;

Username for login to firewall. (if needed)

Published property FWPassword: string read FFWPassword Write FFWPassword;

password for login to firewall. (if needed)

Published 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.

Published property Sock: TTCPBlockSocket read FSock;

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

Published property DSock: TTCPBlockSocket read FDSock;

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

Published property DataStream: TMemoryStream read FDataStream;

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

Published property DataIP: string read FDataIP;

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

Published property DataPort: string read FDataPort;

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

Published 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!

Published property DirectFileName: string read FDirectFileName Write FDirectFileName;

Filename for direct disk data operations.

Published property CanResume: Boolean read FCanResume;

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

Published 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.

Published 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.

Published 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.

Published property OnStatus: TFTPStatus read FOnStatus write FOnStatus;

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

Published property FtpList: TFTPList read FFtpList;

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

Published 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.

Published property AutoTLS: Boolean read FAutoTLS Write FAutoTLS;

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

Published property FullSSL: Boolean read FFullSSL Write FFullSSL;

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

Published property IsTLS: Boolean read FIsTLS;

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

Published property IsDataTLS: Boolean read FIsDataTLS;

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

Published 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