Class TFtpServerForm (unit FtpServ1)

Inherits from

TForm

Constructors



Functions

procedure Cleardisplay1Click(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FormClose(Sender: TObject; var Action: TCloseAction);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FormCreate(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FormShow(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1AlterDirectory(Sender: TObject; Client: TFtpCtrlSocket; var Directory: TFtpString; Detailed: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is called by the FTP component once it has built the } { directory listing.

procedure FtpServer1AnswerToClient(Sender: TObject; Client: TFtpCtrlSocket; var Answer: TFtpString);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1Authenticate(Sender: TObject; Client: TFtpCtrlSocket; UserName, Password: TFtpString; var Authenticated: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1BuildDirectory(Sender: TObject; Client: TFtpCtrlSocket; var Directory: TFtpString; Detailed: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is called when the FTP component needs to build a } { directory listing.

procedure FtpServer1ChangeDirectory(Sender: TObject; Client: TFtpCtrlSocket; Directory: TFtpString; var Allowed: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1ClientCommand(Sender: TObject; Client: TFtpCtrlSocket; var Keyword, Params, Answer: TFtpString);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1ClientConnect(Sender: TObject; Client: TFtpCtrlSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1ClientDisconnect(Sender: TObject; Client: TFtpCtrlSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1RetrDataSent(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1RetrSessionClosed(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1RetrSessionConnected(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is called when the data session for a get file has } { been opened.

procedure FtpServer1Start(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1Stop(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1StorSessionClosed(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure FtpServer1StorSessionConnected(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure ImagesDblClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure MnuQuitClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure MnuStartServerClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure MnuStopServerClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure LoadConfig;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure SaveConfig;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure StartServer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure StopServer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure UpdateClientCount;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure WMAppStartup(var msg: TMessage);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This message handler is triggered by the FormShow event.

Properties

Events

Variables

About1 : TMenuItem;


Cleardisplay1 : TMenuItem;


ClientCountLabel : TLabel;


File1 : TMenuItem;


FtpServer1 : TFtpServer;


GreenImage : TImage;


InfoMemo : TMemo;


MainMenu1 : TMainMenu;


MnuQuit : TMenuItem;


MnuStartServer : TMenuItem;


MnuStopServer : TMenuItem;


N1 : TMenuItem;


Panel1 : TPanel;


RedImage : TImage;


StartMinimizedCheckBox : TCheckBox;


Tools1 : TMenuItem;


FIniFileName : String;


FInitialized : Boolean;


FPort : String;


FXHeight : Integer;


FXLeft : Integer;


FXTop : Integer;


FXWidth : Integer;



Constructors


Functions


procedure Cleardisplay1Click(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FormClose(Sender: TObject; var Action: TCloseAction);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FormCreate(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FormShow(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1AlterDirectory(Sender: TObject; Client: TFtpCtrlSocket; var Directory: TFtpString; Detailed: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is called by the FTP component once it has built the } { directory listing. We can use this handler to alter the listing, adding } { or removing some info. This sample add the 'virtual' directory.


procedure FtpServer1AnswerToClient(Sender: TObject; Client: TFtpCtrlSocket; var Answer: TFtpString);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1Authenticate(Sender: TObject; Client: TFtpCtrlSocket; UserName, Password: TFtpString; var Authenticated: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1BuildDirectory(Sender: TObject; Client: TFtpCtrlSocket; var Directory: TFtpString; Detailed: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is called when the FTP component needs to build a } { directory listing. You can just return without doing anything then the } { component will build the directory for you, based on the actual disk } { content. But you can also build your own directory listing with anything } { you like in it. Just create a stream with the required content. The } { example below construct a virtual directory when the user is on the } { C:\VIRTUAL subdirectory (use elsewhere in this sample program).


procedure FtpServer1ChangeDirectory(Sender: TObject; Client: TFtpCtrlSocket; Directory: TFtpString; var Allowed: Boolean);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1ClientCommand(Sender: TObject; Client: TFtpCtrlSocket; var Keyword, Params, Answer: TFtpString);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1ClientConnect(Sender: TObject; Client: TFtpCtrlSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1ClientDisconnect(Sender: TObject; Client: TFtpCtrlSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1RetrDataSent(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1RetrSessionClosed(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1RetrSessionConnected(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is called when the data session for a get file has } { been opened. This is a good place build a file or a stream if the data } { requested is not already stored in a file on the file system. } { This feature is very powerfull and enable the FTP protocol to be used to } { retrieve any kind of data. It this sample, we just check for C:\VIRTUAL } { directory. If this directory is curent, then a TMemoryStream is created } { on the fly with some data. If another directory is selected, the FTP } { server works as any other: just send the requested file, if it exist ! } { This event handler is also a place where you can abort the file transfer. } { Simply trigger an exception and transfer will not take place. } { Note that if you just wants to prohibe access to some directory or file, } { the best place to code that is in the OnValidateGet or OnValidatePut } { event handlers.


procedure FtpServer1Start(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1Stop(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1StorSessionClosed(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure FtpServer1StorSessionConnected(Sender: TObject; Client: TFtpCtrlSocket; Data: TWSocket; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure ImagesDblClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure MnuQuitClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure MnuStartServerClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure MnuStopServerClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure LoadConfig;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure SaveConfig;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure StartServer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure StopServer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure UpdateClientCount;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure WMAppStartup(var msg: TMessage);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This message handler is triggered by the FormShow event. We comes here } { only when the form is visible on screen.


Properties


Events


Variables


About1 : TMenuItem;


Cleardisplay1 : TMenuItem;


ClientCountLabel : TLabel;


File1 : TMenuItem;


FtpServer1 : TFtpServer;


GreenImage : TImage;


InfoMemo : TMemo;


MainMenu1 : TMainMenu;


MnuQuit : TMenuItem;


MnuStartServer : TMenuItem;


MnuStopServer : TMenuItem;


N1 : TMenuItem;


Panel1 : TPanel;


RedImage : TImage;


StartMinimizedCheckBox : TCheckBox;


Tools1 : TMenuItem;


FIniFileName : String;


FInitialized : Boolean;


FPort : String;


FXHeight : Integer;


FXLeft : Integer;


FXTop : Integer;


FXWidth : Integer;