delphi - How to show all users connected to datasnap server? -


well, taking @ samples rad xe2 has ide. on internet found : monitoring , controlling datasnap tcp/ip connections

my problem how access information user: ipaddress username,etc.. content in

 fconnections.add(tidtcpconnection(event.connection), event.channel); 

in order show in application server grid or connected users. create function sql query verify if user valid.

function usuariovalido(user,password :string):boolean;  begin  server:=tservermethods1.create(nil);   server.listau    begin     close;     parambyname('u').asstring:=user;     parambyname('p').asstring:=password;     execsql();     open;      if isempty   begin     result:=false;   end   else   result:=true;   end; end; 

then on userauthenticate event have:

procedure tservercontainer1.dsauthenticationmanager1userauthenticate(  sender: tobject; const protocol, context, user, password: string; var valid: boolean; userroles: tstrings); begin  valid := usuariovalido(user, password);    if valid    begin     server.cdslistado      begin       append;       server.cdslistadousuario.asstring:=user;       server.cdslistadoip.asstring:='121';       post;    end;  end; end; 

as can see clientdataset in wich insert name , ip of current connection show in dbgrid. can't see changes in dbgrid.

i found other alternative:

  tdssessionmanager.instance.addsessionevent(   procedure(sender: tobject; const eventtype:    tdssessioneventtype; const   session: tdssession)   begin      case eventtype of         sessioncreate:            sessioninicio(session);          sessionclose:            sessionfin(session);        end;   end); 


Comments