Indy 9
TIdTrivialFTPServer
Hierarchy, Properties, Methods, Events, See Also, Unit: IdTrivialFTPServer
Implements a Trivial File Transfer Protocol server.
TIdTrivialFTPServer = class(TIdUDPServer)
Unit
IdTrivialFTPServer
Description
TIdTrivialFTPServer is a TIdUDPServer descendant that implements a Trivial File Transfer Protocol (TFTP) server 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.

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


TIdTrivialFTPServer.Create
TIdTrivialFTPServer, See Also
Creates a new object instance.
constructor Create(axOwner: TComponent); override;
Parameters
axOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Creates initializes the new TIdTrivialFTPServer component, and sets the value in DefaultPort to the standard port number used for the TFTP protocol (IdPORT_TFTP).

TIdTrivialFTPServer.OnReadFile
TIdTrivialFTPServer, See Also
Event handler signalled to read a file on the local file system.
property OnReadFile: TAccessFileEvent;
Description
OnReadFile is a TAccessFileEvent property that represents the event handler allowing the TIdTrivialFTPServer instance to service a Trivial FTP Client request to read a file on the local file system.

Applications must assign a procedure to the OnReadFile event handler to allow responding to the event notification. OnReadFile is used to implement the platform-specific API calls needed to determine access permissions for the client request, and to initialize the stream used for returning the requested file data.


TIdTrivialFTPServer.OnTransferComplete
TIdTrivialFTPServer, See Also
Specifies an event handler for completed TFTP transfers.
property OnTransferComplete: TTransferCompleteEvent;
Parameters
PeerInfo
Information about the peer connection.
Sender
Trivial FTP server generating the event.
SourceStream
Contains data for the peer connection.
Success
Indicates that the transfer was successful.
WriteOperation
Indicates that the transfer was a write operation.
Description
OnTransferComplete is a TTransferCompleteEvent event handler that allows a TrivialFTP server to respond to notifications that a file transfer method has been completed. OnTransferComplete allows the TFTP server to perform operations that may be required for the peer connection or data received on the connection.

An application must assign a procedure to the event handler to allow a response to the event notification. Note: If no user event handler exists, SourceStream is automatically freed.


TIdTrivialFTPServer.OnWriteFile
TIdTrivialFTPServer
Specifies the event handler for client Put operations.
property OnWriteFile: TAccessFileEvent;
Parameters
AStream
Contains data to be written to the local file system.
FileName
File name on the server file system.
FreeStreamOnComplete
Indicates that the Stream should be freed.
GrantAccess
Indicates that the file operation is permitted.
PeerInfo
Information about the client connection.
Sender
Trivial FTP server generating the event.
Description
OnWriteFile is a TAccessFileEventevent handler that allows the TrivialFTP server to respond to client PUT requests.

GrantAccess should be updated in the event handler to indicate if the write operation should be allowed by the server. When GrantAccess is True and AStream is not Nil, the event handler should update the local file system to reflect the contents of AStream for the file specified in FileName.

FreeStreamOnComplete indicates that the OnTransferComplete event handler should free the stream specified in AStream.


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