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;
Type-cast the TIdContext
to a TIdServerContext
, then you can access its public Server
property:
procedure TMainWindow.OnConnect(AContext: TIdContext);
var
ParentServer : TIdCustomTCPServer;
begin
ParentServer := TIdServerContext(AContext).Server;
...
end;