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;