idqotdserver.pas
来自「indy的原文件哈!大家可以下来参考和学习之用.也可以用以作组件.开发其他的应用」· PAS 代码 · 共 75 行
PAS
75 行
{ $HDR$}
{**********************************************************************}
{ Unit archived using Team Coherence }
{ Team Coherence is Copyright 2002 by Quality Software Components }
{ }
{ For further information / comments, visit our WEB site at }
{ http://www.TeamCoherence.com }
{**********************************************************************}
{}
{ $Log: 10283: IdQotdServer.pas
{
{ Rev 1.0 2002.11.12 10:48:38 PM czhower
}
unit IdQotdServer;
interface
{
2000-May-15 J. Peter Mugaas
-renamed events to have Id prefix
2000-Apr-22 J Peter Mugaas
Ported to Indy
2000-Jan-13 MTL
Moved to new Palette Scheme (Winshoes Servers)
1999-May-13
Final Version
Original Author: Ozz Nixon
(RFC 865) [less than 512 characters total, multiple lines OK!]
}
uses
Classes,
IdAssignedNumbers,
IdTCPServer;
Type
TIdQOTDGetEvent = procedure ( Thread: TIdPeerThread ) of object;
TIdQOTDServer = class ( TIdTCPServer )
protected
FOnCommandQOTD : TIdQOTDGetEvent;
//
function DoExecute ( Thread : TIdPeerThread ): boolean; override;
public
constructor Create ( AOwner : TComponent ); override;
published
property OnCommandQOTD : TIdQOTDGetEvent read fOnCommandQOTD
write fOnCommandQOTD;
property DefaultPort default IdPORT_QOTD;
end;
implementation
uses
SysUtils;
constructor TIdQOTDServer.Create ( AOwner : TComponent );
begin
inherited;
DefaultPort := IdPORT_QOTD;
end;
function TIdQOTDServer.DoExecute ( Thread: TIdPeerThread ) : boolean;
begin
result := true;
if Thread.Connection.Connected then begin
if assigned ( OnCommandQOTD ) then begin
OnCommandQOTD ( Thread );
end;
end;
Thread.Connection.Disconnect;
end; {doExecute}
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?