| Class THsSocket (unit Hssock) |
TForm
| Constructors |
| Functions |
procedure CloseBtnClick(Sender: TObject);
procedure CmdSktDisconnect(Sender: TObject; Socket: TSocketBase);
procedure CmdSktRead(Sender: TObject; Socket: TSocketBase);
procedure DataSktConnect(Sender: TObject; Socket: TSocketBase);
procedure DataSktDisconnect(Sender: TObject; Socket: TSocketBase);
procedure DataSktRead(Sender: TObject; Socket: TSocketBase);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure ListenSktDisconnect(Sender: TObject; Socket: TSocketBase);
procedure ListenSktRead(Sender: TObject; Socket: TSocketBase);
procedure SktWrite(Sender: TObject; Socket: TSocketBase);
procedure CloseLog;
procedure DisplayDebugForm(ShowFlag : boolean);
function FtpChangeDir(Directory : String) : boolean;send Change directory command
function FtpConnect(Address : String; Port : integer) : boolean;
function FtpDelete(RemoteFile : String) : boolean;
function FtpDisconnect : boolean;
function FtpListDir(Filter : String; ListFile : String) : boolean;
function FtpPassive : boolean;
function FtpPassword(Password : String) : boolean;
function FtpPort : boolean;
function FtpRetrieveFile(LocalFile : String; RemoteFile : String) : boolean;
function FtpSetType(FtpType : TFtpType) : boolean;
function FtpSite(Command : String) : boolean;
function FtpStoreFile(LocalFile : String; RemoteFile : String) : boolean;
function FtpUser(User : String) : boolean;
procedure OpenLog(LogFileName : String);open debug log file and indicate we are in debug mode
procedure SetTimeOut(Seconds : integer);set number of seconds until wait times out; default is 10 seconds
function ActionCompleted : boolean;TEmSocket manually written methods (sorted alphabetically) } { ActionCompleted is the key routine for serializing asynchronous behavior.
procedure AddDiagnostic(Msg : String);
procedure CloseSkt(Skt : TBasicClientSocket);
procedure DisplayError(Msg : String);
procedure DoDataSktDisconnect(Socket : TSocketBase);
procedure DoDataSktRead(Socket: TSocketBase);
procedure SendCommand(Msg : String);
function SendSktData(Socket : TSocketBase; Buffer : PChar; Count : integer) :
boolean;
procedure SetWaitState(Value : TWaitState);| Properties |
| Events |
| Variables |
CloseBtn : TButton;
CmdSkt : TBasicClientSocket;
DataSkt : TBasicClientSocket;
DebugMemo : TMemo;
ListenSkt : TBasicServerSocket;
FActionCompleted : boolean;
LogFile : TextFile;
LogFlag : boolean;
OnWriteFlag : boolean;
OutputFile : File;
PartialRecvBuffer : string;
PasvFlag : boolean;
RecvData : String;
RecvList : TStringList;
ResetTime : boolean;
WaitState : TWaitState;| Constructors |
| Functions |
procedure CloseBtnClick(Sender: TObject);make debug form invisible if user presses close button
procedure CmdSktDisconnect(Sender: TObject; Socket: TSocketBase);command connection OnDisconnect handler
procedure CmdSktRead(Sender: TObject; Socket: TSocketBase);end of manually written methods } { event handlers } { command connection OnRead event handler
procedure DataSktConnect(Sender: TObject; Socket: TSocketBase);OnConnect handler for passive mode data connection
procedure DataSktDisconnect(Sender: TObject; Socket: TSocketBase);OnDisconnect handler for passive mode data connection
procedure DataSktRead(Sender: TObject; Socket: TSocketBase);OnRead handler for passive mode data connection
procedure FormCreate(Sender: TObject);OnCreate handler for form
procedure FormDestroy(Sender: TObject);OnDestroy handler for form
procedure ListenSktDisconnect(Sender: TObject; Socket: TSocketBase);OnDisconnect handler for port mode data connection
procedure ListenSktRead(Sender: TObject; Socket: TSocketBase);OnRead handler for port mode data connection
procedure SktWrite(Sender: TObject; Socket: TSocketBase);OnWrite handler for all 3 sockets
procedure CloseLog;end writing to debug log
procedure DisplayDebugForm(ShowFlag : boolean);display HSSocket form for debugging purposes
function FtpChangeDir(Directory : String) : boolean;ftp methods
send Change directory command
function FtpConnect(Address : String; Port : integer) : boolean;connect command socket to FTP server
function FtpDelete(RemoteFile : String) : boolean;send delete file command to FTP server
function FtpDisconnect : boolean;send disconnect command to FTP server
function FtpListDir(Filter : String; ListFile : String) : boolean;send list directory command to FTP server
function FtpPassive : boolean;set up passive mode data connection
function FtpPassword(Password : String) : boolean;send login password to FTP server
function FtpPort : boolean;set up port mode data connection
function FtpRetrieveFile(LocalFile : String; RemoteFile : String) : boolean;download file from FTP server
function FtpSetType(FtpType : TFtpType) : boolean;set data connection type to either ascii or binary
function FtpSite(Command : String) : boolean;site commands are specific to certain kinds of FTP servers (usually mainframes) } { the FTP server administrator must tell you what SITE commands are required } { fortunately, these are not required by most FTP servers
function FtpStoreFile(LocalFile : String; RemoteFile : String) : boolean;upload a file to an FTP server
function FtpUser(User : String) : boolean;send login name to ftp server
procedure OpenLog(LogFileName : String);debugging methods
open debug log file and indicate we are in debug mode
procedure SetTimeOut(Seconds : integer);other methods
set number of seconds until wait times out; default is 10 seconds
function ActionCompleted : boolean;methods
TEmSocket manually written methods (sorted alphabetically) } { ActionCompleted is the key routine for serializing asynchronous behavior. It is called after each command is sent to the FTP server. It waits until either the server returns a successful status code or the wait times out. It returns True on success, False on failure
procedure AddDiagnostic(Msg : String);display debug messages if debugging turned on
procedure CloseSkt(Skt : TBasicClientSocket);called to make sure socket is closed before reopening it
procedure DisplayError(Msg : String);display debug error message
procedure DoDataSktDisconnect(Socket : TSocketBase);event handler for OnDisconnect of both passive and port data sockets
procedure DoDataSktRead(Socket: TSocketBase);event handler for OnRead of both passive and port data sockets
procedure SendCommand(Msg : String);append cr/lf prior to sending a command
function SendSktData(Socket : TSocketBase; Buffer : PChar; Count : integer) :
boolean;send data to FTP server
procedure SetWaitState(Value : TWaitState);set state variable to indicate which command is in process
| Properties |
| Events |
| Variables |
CloseBtn : TButton;port mode data connection
CmdSkt : TBasicClientSocket;
DataSkt : TBasicClientSocket;command connection
DebugMemo : TMemo;
ListenSkt : TBasicServerSocket;passive mode data connection
FActionCompleted : boolean;data
LogFile : TextFile;
LogFlag : boolean;
OnWriteFlag : boolean;
OutputFile : File;
PartialRecvBuffer : string;
PasvFlag : boolean;
RecvData : String;
RecvList : TStringList;
ResetTime : boolean;
WaitState : TWaitState;