📄 psiintercept.pas
字号:
unit PsiIntercept;
//******************************************************************************
// The original software is under
// Copyright (c) 1993 - 2000, Chad Z. Hower (Kudzu)
// and the Indy Pit Crew - http://www.nevrona.com/Indy/
//
// Amended : November 2000, by Michael M. Michalak MACS for use with
// MorphTek.com Inc Peer to Peer Open Source Components - http://www.morphtek.com
//
//******************************************************************************
interface
uses
Classes,
PsiBaseComponent, PsiSocketHandle;
type
TPsiConnectionIntercept = class(TPsiBaseComponent)
protected
FBinding: TPsiSocketHandle;
FOnConnect: TNotifyEvent;
FRecvHandling: Boolean;
FSendHandling: Boolean;
FIsClient: Boolean;
public
procedure Connect(ABinding: TPsiSocketHandle); virtual;
procedure DataReceived(var ABuffer; const AByteCount: integer); virtual;
procedure DataSent(var ABuffer; const AByteCount: integer); virtual;
procedure Disconnect; virtual;
function Recv(var ABuf; ALen: Integer): Integer; virtual;
function Send(var ABuf; ALen: Integer): Integer; virtual;
//
property Binding: TPsiSocketHandle read FBinding;
property IsClient: Boolean read FIsClient;
property RecvHandling: boolean read FRecvHandling;
property SendHandling: boolean read FSendHandling;
published
property OnConnect: TNotifyEvent read FOnConnect write FOnConnect;
end;
TPsiServerIntercept = class(TPsiBaseComponent)
public
procedure Init; virtual; abstract;
function Accept(ABinding: TPsiSocketHandle): TPsiConnectionIntercept; virtual; abstract;
end;
implementation
{ TPsiConnectionIntercept }
procedure TPsiConnectionIntercept.Disconnect;
begin
FBinding := nil;
end;
procedure TPsiConnectionIntercept.DataReceived(var ABuffer; const AByteCount: integer);
begin
end;
function TPsiConnectionIntercept.Recv(var ABuf; ALen: Integer): Integer;
begin
result := 0;
end;
function TPsiConnectionIntercept.Send(var ABuf; ALen: Integer): Integer;
begin
result := 0;
end;
procedure TPsiConnectionIntercept.DataSent(var ABuffer; const AByteCount: integer);
begin
end;
procedure TPsiConnectionIntercept.Connect(ABinding: TPsiSocketHandle);
begin
FBinding := ABinding;
if assigned(FOnConnect) then begin
FOnConnect(Self);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -