2

I make different instances of TIdTcpServer and assign a pointer to the Data property that I need later on if a Client Connects/Disconnects/Executes.

Is it possible to get the "Parent" TIdTcpServer from a TIdContext?

If so, how can I do that?

Example:

procedure TMainWindow.OnConnect(AContext: TIdContext);
var
 ParentServer : TIdTcpServer; 
begin
  // ParentServer := AContext... 
end;
4

1 回答 1

2

将类型TIdContext转换为 a TIdServerContext,然后您可以访问其公共Server属性:

procedure TMainWindow.OnConnect(AContext: TIdContext);
var
  ParentServer : TIdCustomTCPServer; 
begin
  ParentServer := TIdServerContext(AContext).Server;
  ...
end;
于 2013-07-18T23:29:22.490 回答