ct;
Socket: TCustomWinSocket);
procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
procedure ServerSocket1Listen(Sender: TObject;
Socket: TCustomWinSocket);
procedure AppException(Sender: TObject; E: Exception);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
Service_Enabled: boolean; {代理服务是否开启}
session: array of session_record; {会话数组}
sessions: integer; {会话数}
LookUpTimeOut: integer; {连接超时值}
InvalidRequests: integer; {无效请求数}
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
file://系统启动定时器,启动窗显示完成后,缩小到System Tray…
procedure TForm1.Timer2Timer(Sender: TObject);
begin
timer2.Enabled:=false; {关闭定时器}
sessions:=0; {会话数=0}
Application.OnException := AppException; {为了屏蔽代理服务器出现的异常}
invalidRequests:=0; {0错误}
LookUpTimeOut:=60000; {超时值=1分钟}
timer1.Enabled:=true; {打开定时器}
n11.Enabled:=false; {开启服务菜单项失效}
n21.Enabled:=true; {关闭服务菜单项有效}
serversocket1.Port:=988; {代理服务器端口=988}
serversocket1.Active:=true; {开启服务}
form1.hide; {隐藏界面,缩小到System Tray上}
end;
file://开启服务菜单项…
procedure TForm1.N11Click(Sender: TObject);
begin
serversocket1.Active:=true; {开启服务}
end;
file://停止服务菜单项…
procedure TForm1.N21Click(Sender: TObject);
begin
serversocket1.Active:=false; {停止服务}
N11.Enabled:=True;
N21.Enabled:=False;
Service_Enabled:=fal