constructor TfrmMain.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
sfLogger.setAppender(TStringsAppender.Create(mmoLog.Lines));
sfLogger.AppendInMainThread := true;
FTcpServer := TDiocpTcpServer.Create(Self);
FTcpServer.Name := 'iocpSVR';
FTcpServer.OnDataReceived := self.OnRecvBuffer;//数据接收事件
FTcpServer.OnContextAccept := OnAccept;//接受连接时触发事件
FTcpServer.createDataMonitor;//创建数据监控中心实例
FTcpServer.OnSendBufferCompleted := OnSendBufferCompleted;//数据发送完成触发事件
FTcpServer.OnContextDisconnected := OnDisconnected;//当连接断开时触发事件
FPool := NewBufferPool(FTcpServer.WSARecvBufferSize);
TFMMonitor.createAsChild(pnlMonitor, FTcpServer);
ReadState;
end;
其实,最近发现不光要看程序单元文件,还要看引用单元文件,去源码中,你发现很多,弦子介绍已经非常详细了!