目前是1394。

明白session如何使用管理,看demo Session List和SessionTimeout

unit Main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
uniGUIClasses, uniGUIRegClasses, uniGUIForm, uniGUIBaseClasses, uniButton,
DB, DBClient, uniBasicGrid, uniDBGrid; type
TUniSessionInfoRec = record
ASessionId : string;
AIP : string;
AMyVar : string;
ALastTime: TDateTime;
end; TMainForm = class(TUniForm)
UniButton1: TUniButton;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
ClientDataSet1SessionId: TStringField;
ClientDataSet1IP: TStringField;
ClientDataSet1LastTime: TDateTimeField;
UniDBGrid1: TUniDBGrid;
ClientDataSet1MyVar: TStringField;
procedure UniButton1Click(Sender: TObject);
procedure UniFormCreate(Sender: TObject); { Private declarations }
public
{ Public declarations }
ASessionList : array of TUniSessionInfoRec;
end; function MainForm: TMainForm; implementation {$R *.dfm} uses
uniGUIVars, MainModule, uniGUIApplication, uniGUISessionManager,
ServerModule; function MainForm: TMainForm;
begin
Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));
end; procedure TMainForm.UniButton1Click(Sender: TObject);
var
S : TUniGUISessions;
U : TUniGUISession;
I : Integer;
begin
S := UniServerModule.SessionManager.Sessions;
S.Lock; // Using Lock on session manager should be used with extreme care.
// We should keep the "Lock duration" as short as we can. Session Manager stops working until lock is released.
// Excessive use of lock/unlock or keeping the lock active for a long period will make uniGUI server slow/unresponsive.
try
SetLength(ASessionList, S.SessionList.Count); // Here we do a fast copy of list to another array for later use.
for I := to S.SessionList.Count - do
begin
U := S.SessionList[I];
ASessionList[I].ASessionId := U.SessionId;
ASessionList[I].AIP := U.RemoteIP;
ASessionList[I].ALastTime := U.LastTimeStamp;
if U.UniMainModule <> nil then // Check mainModule availability. Some sessions may not have a MainModule instance
ASessionList[I].AMyVar := (U.UniMainModule as TUniMainModule).FMyStringVar; // Access custom MainModule props
end;
finally
S.Unlock; // ... and finally don't forget to release lock!
end; ClientDataSet1.EmptyDataSet;
for I := Low(ASessionList) to High(ASessionList) do
begin
ClientDataSet1.Append;
ClientDataSet1.FieldByName('sessionid').AsString := ASessionList[I].ASessionId;
ClientDataSet1.FieldByName('ip').AsString := ASessionList[I].AIP;
ClientDataSet1.FieldByName('lasttime').AsDateTime := ASessionList[I].ALastTime;
ClientDataSet1.FieldByName('myvar').AsString := ASessionList[I].AMyVar;
ClientDataSet1.Post;
end; end; procedure TMainForm.UniFormCreate(Sender: TObject);
begin
UniMainModule.FMyStringVar := TimeToStr(Now);
end; initialization
RegisterAppFormClass(TMainForm); end.

注意代码中的注释

unigui的session【1】的更多相关文章

  1. 记录一段QQ关于 UNIGUI 的Session 时间设定

    记录一段QQ关于 UNIGUI 的Session 时间设定,来自[台中]cmj(31365722):  [重點說明] 1.UniGUI的Session就是UniMainModule.   2.Sess ...

  2. 【转】UniGUI Session管理說明

    [转]UniGUI Session管理說明 (2015-12-29 15:41:15) 转载▼   分类: uniGUI 台中cmj朋友在uniGUI中文社区QQ群里发布的,转贴至此. UniGUI ...

  3. unigui session超时时间设置

    unigui session超时时间设置 默认的SESSION超时时间是10分钟. 网络 SOCKET 程序,像 数据库,中间件,UNIGUI等...为了防止过多的僵死连接卡死服务端,服务端都会主动踢 ...

  4. UNIGUI:How to redirect and close session?

    Hello, i would have 2 unigui app. the first app is a simple authentification app and second will be ...

  5. unigui数据库连接池

    UNIGUI for delphi,是一款WEB RIA开发框架.开发WEB程式如传统C/S般简单,众多DELPHIER趋之若鹜. 虽然上手非常容易,但要真正使用好,有些地方还是值得考究的. 网上有同 ...

  6. Datasnap 服务端 (Server)Session 管理 --- 解决 全示例慢(Google)

    Datasnap 服务端 (Server)Session  管理:  http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Server_Side_Ses ...

  7. unigui日志

    unigui日志 uniGUI本身提供了日志功能,利用uniServerModule.ServerLogger来控制如何写日志: Enabled:是否写日志 Options:logIndyExcept ...

  8. uniGUI日志的控制

    uniGUI日志的控制 (2015-10-12 08:30:29) 转载▼ 标签: unigui 分类: uniGUI uniGUI本身提供了日志功能,利用uniServerModule.Server ...

  9. unigui如何连接数据库

    unigui如何连接数据库 UNIGUI既可以二层直连数据库,也可以通过中间件连接数据库. 这里只介绍UNIGUI二层直连数据库. 数据库连接控件.数据集控件都要拖放在MainModule窗体上.UN ...

随机推荐

  1. ASP.NET Web Projects

    https://msdn.microsoft.com/en-us/library/ywdtth2f.aspx The topics in this section describe how to cr ...

  2. AD、DNS、DHCP、IIS、WINS的形象定义及关系

    AD-实际是就是一个包括所有信息的数据库,和现实生活中就将其比作派出所,所有的信息都要进入他那的数据库当中(包括人员姓名(计算机名.账号.密码等) DNS就是建立起关联起好记忆的名称,比如你家的位置用 ...

  3. YES,IT IS

  4. selenium3 + python - iframe

    一.frame和iframe区别 Frame与Iframe两者可以实现的功能基本相同,不过Iframe比Frame具有更多的灵活性. frame是整个页面的框架,iframe是内嵌的网页元素,也可以说 ...

  5. Akka源码分析-FSM

    akka还有一个不常使用.但我觉得比较方便的一个模块,那就是FSM(有限状态机).我们知道了akka中Actor模型的具体实现之后,就会发现,Akka的actor可以非常方便的实现FSM.其实在akk ...

  6. Akka源码分析-Remote-ActorSystem

    前面的文章都是基于local模式分析的,现在我们简要分析一下在remote模式下,ActorSystem的创建过程. final val ProviderClass: String = setup.g ...

  7. python中set元素为可迭代元素相加

    #a 与 b必须是两个相同类型的可迭代对象 a = "1" b = "2" print(set(a + b))  # {'1', '2'} a = " ...

  8. linux命令(001) -- chkconfig

    一.准备知识 在说明chkconfig命令的用途之前,有必要先了解一下Linux系统中/etc/rc[0-6].d目录的用途. 众所周知,在Linux系统定义了7种不同的启动级别,这7种启动级别的含义 ...

  9. [转]Linux之ACL权限

    转自:http://www.2cto.com/os/201110/108736.html 引言 前面的内容中,我们讲到传统的权限仅有三种身份(owner,group,others)搭配三种权限(r,w ...

  10. vue-cli的创建、基本配置和遇到的问题总结

    vue-cli的创建及基本配置 1. 创建 vue-cli 项目 确保本地安装了最新版本的nodejs环境(会自带npm环境); 全局安装vue-cli,命令:npm i -g vue-cli 创建项 ...