ActiveConnections: TClientDataSet;
。。。
有客户端连接上来的时候
procedure TForm8.DSServer1Connect(DSConnectEventObject: TDSConnectEventObject);
begin
ActiveConnections.Insert;
if DSConnectEventObject.ChannelInfo <> nil then
begin
ActiveConnections['ID'] := DSConnectEventObject.ChannelInfo.Id;
ActiveConnections['Info'] := DSConnectEventObject.ChannelInfo.Info;
end;
ActiveConnections['UserName'] := DSConnectEventObject.ConnectProperties[TDBXPropertyNames.UserName];
ActiveConnections['ServerConnection'] := DSConnectEventObject.ConnectProperties[TDBXPropertyNames.ServerConnection];
ActiveConnections.Post;
end;
有客户端断开连接的时候
procedure TForm8.DSServer1Disconnect(
DSConnectEventObject: TDSConnectEventObject);
begin
if ActiveConnections.Locate('ID', DSConnectEventObject.ChannelInfo.Id,[]) then
ActiveConnections.Delete;
end;