Indy 9
TIdTrivialFTP
Hierarchy, Properties, Methods, Events, See Also, Unit: IdTrivialFTP
Implements a Trivial File Transfer Protocol client.
TIdTrivialFTP = class(TIdUDPClient)
Unit
IdTrivialFTP
Description
TIdTrivialFTP is a TIdUDPClient descendant that implements a Trivial File Transfer Protocol (TFTP) client as described in the Internet Standards documents:

  • RFC 1350 - Trivial File Transfer Protocol (http://www.rfc-editor.org/rfc/rfc1350.txt)

  • RFC 1782 - TFTP Option Extension (http://www.rfc-editor.org/rfc/rfc1782.txt)

  • RFC 1783 - TFTP Blocksize Option (http://www.rfc-editor.org/rfc/rfc1783.txt)

Trivial FTP is an extremely lightweight and simple UDP-Based file transfer protocol that is normally used read and write files from/to a remote server. TFTP cannot list directories, and currently has no provisions for user authentication.

TIdTrivialFTP supports the TFP Option Negotiation Protocol where the client appends options at the end of the Read Request or Write request packet. TIdTrivialFTP also supports the TFTP Blocksize Option which allows the client and server to negotiate a blocksize more applicable to the network medium.


TIdTrivialFTP.OnWork
TIdTrivialFTP, See Also
Specifies the event handler when data is sent or received.
property OnWork;
Description
OnWork is a TWorkEvent property that represents the event handler triggered when a Get or Put request has been made, and the method is started. When AWorkMode is wmRead Mode (Get method) or wmWrite Mode (Put method), the amount of data transmitted is available in ACount.

TIdTrivialFTP.OnWorkBegin
TIdTrivialFTP
Specifies an event handler for a data request.
property OnWorkBegin;
Description
OnWorkBegin is an event handler that allows the TFTP client to respond to a Get or Put request notification. OnWorkBegin is triggered when has been made, and is about to begin transferring data.

Work mode will contain wmRead for Get operations, and wmWrite for Put operations.


TIdTrivialFTP.OnWorkEnd
TIdTrivialFTP
Specifies an event handler for a complete file operation.
property OnWorkEnd;
Description
OnWorkEnd is an event handler that allows the TFTP client to respond to a complete file operation. OnWorkEnd is triggered when a request has been made and the method completes. Work mode will contain wmRead for Get operations or wmWrite for Put operations.

TIdTrivialFTP.RequestedBlockSize
TIdTrivialFTP
Identifies of bytes to transmit before an acknowledgement is required.
property RequestedBlockSize: Integer;
Description
RequestedBlockSize is an Integer property that identifies the number of bytes to use as Block when reading or writing file data on the TFTP server. Normally a file cannot be transmitted in a single block. RequestedBlockSize specifies the number of bytes that can transmitted before an acknowledgement is required.

The default value for RequestedBlockSize is 1500. Note: Changing the value of RequestedBlockSize can adversely affect the performance of the protocol.


TIdTrivialFTP.TransferMode
TIdTrivialFTP
Specifies the transfer mode for data on TFTP connection.
property TransferMode: TIdTFTPMode;
Description
TIdTFTPMode is an enumerated type that specifies the transfer mode for data on TFTP connection, and can contain the values tfNetAscii and tfOctet.

tfNetAscii indicates that the connection will transmit data using the netascii, or "USA Standard Code for Information Interchange", format defined in the Telnet protocol specification. tfNetAscii will contain 8-bit ASCII data.

tfOctet indicates that the connection will transmit raw 8-bit data, or binary data.


TIdTrivialFTP.Create
TIdTrivialFTP
Creates a new object instance.
constructor Create(AnOwner: TComponent); override;
Parameters
AnOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance, and creates a new TIdTrivialFTP component. Create sets the default port to the standard port number used for the TFTP protocol (IdPORT_TFTP). The constructor also sets TransferMode to tfOctet, RequestedBlockSize to 1500, and ReceiveTimeout to 4000.

TIdTrivialFTP.Get
TIdTrivialFTP
Retrieve a file from a TrivialFTP server.
procedure Get(const ServerFile: String; DestinationStream: TStream); overload;
procedure Get(const ServerFile: String; const LocalFile: String); overload;
Parameters
const ServerFile: String
File name on the server.
DestinationStream: TStream
Destination for retrieved file data.
const LocalFile: String
File name on the local file system.
Description
Get is an overloaded method to retrieve a file from a TrivialFTP server.

The version requiring a local filename creates a TFileStream, then calls the stream version of the Get method (it is freed automatically).

The stream version of the Get method transmits the stream, firing the onWork, onWorkBegin, onWorkEnd during the process.


TIdTrivialFTP.Get
TIdTrivialFTP
Retrieve a file from a TrivialFTP server.
procedure Get(const ServerFile: String; DestinationStream: TStream); overload;
procedure Get(const ServerFile: String; const LocalFile: String); overload;
Parameters
const ServerFile: String
File name on the server.
DestinationStream: TStream
Destination for retrieved file data.
const LocalFile: String
File name on the local file system.
Description
Get is an overloaded method to retrieve a file from a TrivialFTP server.

The version requiring a local filename creates a TFileStream, then calls the stream version of the Get method (it is freed automatically).

The stream version of the Get method transmits the stream, firing the onWork, onWorkBegin, onWorkEnd during the process.


TIdTrivialFTP.Put
TIdTrivialFTP
Sends a file to a TrivialFTP server.
procedure Put(SourceStream: TStream; const ServerFile: String); overload;
procedure Put(const LocalFile: String; const ServerFile: String); overload;
Parameters
SourceStream: TStream
Contains the data to be sent to the TFTP server.
const ServerFile: String
File name of the TFTP server.
const LocalFile: String
File name on the local file system.
Description
Put is an overloaded method to send a file to a TrivialFTP server.

The version requiring a local filename creates a TFileStream, then calls the stream version of the Put method (it is freed automatically).

The stream version of the Put method transmits the stream, firing the onWork, onWorkBegin, onWorkEnd during the process.


TIdTrivialFTP.Put
TIdTrivialFTP
Sends a file to a TrivialFTP server.
procedure Put(SourceStream: TStream; const ServerFile: String); overload;
procedure Put(const LocalFile: String; const ServerFile: String); overload;
Parameters
SourceStream: TStream
Contains the data to be sent to the TFTP server.
const ServerFile: String
File name of the TFTP server.
const LocalFile: String
File name on the local file system.
Description
Put is an overloaded method to send a file to a TrivialFTP server.

The version requiring a local filename creates a TFileStream, then calls the stream version of the Put method (it is freed automatically).

The stream version of the Put method transmits the stream, firing the onWork, onWorkBegin, onWorkEnd during the process.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.