Question:

want to close the old Session - if the same username starts a new Session

Any ideas how i can do this? - one user should not be able to start the Software unlimited in his company - every user should buy a licence .

Answer:

var
  ASessionList: TList;
  I : Integer;
  M : TUniMainModule;
  USession : TUniGUISession;
begin
  ASessionList := UniServerModule.SessionManager.Sessions.SessionList.LockList;
  try
    for I := 0 to ASessionList.Count -1 do
    begin
      USession := TUniGUISession(ASessionList[i]);
      M := USession.UniMainModule as TUniMainModule;
      if M.username = 'ThisUserName' then
      begin
        USession.TerminateAfterSecs(0);
        Break;
      end;
    end;
  finally
    UniServerModule.SessionManager.Sessions.SessionList.UnlockList;
  end;
end; Question:
 If I want to send a message to another session of the same user before I kill it,how do I do?
Answer:
begin USession := TUniGUISession(ASessionList[i]);
M := USession.UniMainModule as TUniMainModule;
if M.username = 'ThisUserName' then
begin
M.LMessageStr := 'Your Session will Terminate after 10 Sec !!!';////// <---
USession.TerminateAfterSecs(10); Break;
end;
end; // And in the MainForm. a Timer With this code:
procedure TMainFrm.UniTimer1Timer(Sender: TObject);
begin
if UniMainModule.LMessageStr <> '' then
begin
ShowMessage(UniMainModule.LMessageStr);
UniMainModule.LMessageStr := '';
end;
end;
 

how to close the old Session - if the same username starts a new Session?的更多相关文章

  1. redis/分布式文件存储系统/数据库 存储session,解决负载均衡集群中session不一致问题

    先来说下session和cookie的异同 session和cookie不仅仅是一个存放在服务器端,一个存放在客户端那么笼统 session虽然存放在服务器端,但是也需要和客户端相互匹配,试想一个浏览 ...

  2. Session 知识点再整理(二) 自定义 Session 存储机制

    对于访问量大的网站,用默认的 Session 存储方式(以文件存储)不适合,因为文件的 I/O 开销会非常大,另外 Session 机制本身使 Session 不能跨机访问,在 Web 集群中无法达到 ...

  3. SESSION和COOKIE的作用和区别,SESSION信息的存储方式,如何进行遍历?

    二者的定义:当你在浏览网站的时候,WEB 服务器会先送一小小资料放在你的计算机上,Cookie 会帮你在网站上所打的文字或是一些选择,都纪录下来.当下次你再光临同一个网站,WEB 服务器会先看看有没有 ...

  4. Session变量不能转移到下页.解决: session.use_trans_sid = 1

    附:文摘 ============================================================ 在PHP使用SESSION的朋友可能会碰到这么一个问题.SESSIO ...

  5. 一篇文章让你深透理解cookie和session,附带分布式WEB系统redis共享session方案

    cookie和session有什么区别?这是一个很基础的知识点,大家可能都知道一个大概:cookie是存在客户端的,session是存储在服务端,cookie和session用来验证识别用户的登录状态 ...

  6. Session会话保持机制的原理与Tomcat Session共享的几种实现方式(Session Cluster、memcached+MSM)

    一.Session的定义 在计算机科学中,特别是在网络中,session是两个或更多个通信设备之间或计算机和用户之间的临时和交互式信息交换.session在某个时间点建立,然后在之后的某一时间点拆除. ...

  7. [转]session和cookie的区别和联系,session的生命周期,多个服务部署时session管理

    Session和Cookie的区别 对象 信息量大小 保存时间 应用范围 保存位置 Session 小量,简单的数据 用户活动时间+一段延迟时间(一般为20分钟) 单个用户 服务器端 Cookie 小 ...

  8. cookie,Session机制的本质,跨应用程序的session共享

    目录:一.术语session二.HTTP协议与状态保持三.理解cookie机制四.理解session机制五.理解javax.servlet.http.HttpSession六.HttpSession常 ...

  9. 第十六节:Asp.Net Core中Session的使用、扩展、进程外Session

    一. 简介 关于Session的原理可参照Asp.Net版本Session的文章,去查阅. 1. 普通用法 (1).通过Nuget引入[Microsoft.AspNetCore.Http]程序集,Co ...

随机推荐

  1. JAVA、Android与Cordova环境搭建

    一些坑(如Manager.exe闪退的问题)请查看:https://www.cnblogs.com/CyLee/p/9911195.html 官方网址: # Cordova http://cordov ...

  2. LeetCode226 InvertBinaryTree Java题解

    题目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 解答: 遍历每个节点  直接交换他们的 ...

  3. maven的一些基础命令

    1.显示当前构建的实际pom,包括活动的Profile mvn help:effective-pom 2.打印出项目的世界settings,包含从全局的settings和用户级别settings继承的 ...

  4. 解读Unity中的CG编写Shader系列3——表面剔除与剪裁模式

    在上一个样例中,我们得到了由mesh组件传递的信息经过数学转换至合适的颜色区间以颜色的形式着色到物体上. 这篇文章将要在此基础上研究片段的擦除(discarding fragments)和前面剪裁.后 ...

  5. ubuntu16.04 安装系统之后的开发必备-sourcelist--idk-sublime--opencv

    设置sourcelist.txt # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/ub ...

  6. Swift_1_基本数据类型

    import Foundation println("Hello, World!"); var v1 = 1; var v2 = 2; println(" v1 is \ ...

  7. windows 10右键项添加Notepad++

    1.打开注册表编辑器,开始->运行->regedit. 2.在HKEY_CLASSSES_ROOT→ * → Shell 下,在Shell下,新建项命名为Open With Notepad ...

  8. python 学习2 测试报告

    1. py.test test_class.py  --resultlog=./log.txt 2.生成html格式 py.test test_class.py --html=./report.htm ...

  9. 【转】Jenkins+Ant+Jmeter接口自动化集成测试实例

    出处:https://my.oschina.net/MrToStudy/blog/742251 一.Jenkins安装配置 1.安装配置JDK1.6+环境变量: 2.下载jenkins.war,放入C ...

  10. 浏览器登录cookie

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...