datasnap的监督功能【1】-服务端获取客户端连接信息
在服务端获取连接的客户端相关info:
TDBXClientInfo = recoed IpAddress : String; ClientPort : String; Protocol : String; AppName : String;//web客户端才有此参数 end
TDBXClientInfo 通过TDSConnectionEventObject对象。
TDSConnectionEventObject对象是TDSServer.OnConnect事件处理函数的参数
procedure TServerContainer.DSServerConnect(DSConnectEventObject : TDSConnectEventObject); var sb : TStringBuilder; begin sb := TStringBuilder.Create; try sb.Append('AppName:'+DSConnectEventObject.ChannelInfo.ClientInfo.AppName); sb.Append('Protocol:'+DSConnectEventObject.ChannelInfo.ClientInfo.Protocol); sb.Append('IpAddress:'+DSConnectEventObject.ChannelInfo.ClientInfo.IpAddress); sb.Append('ClientPort:'+DSConnectEventObject.ChannelInfo.ClientInfo.ClientPort);
showmessage(sb.ToString); finally sb.free; end; end;