目前是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. hbase查询_Phoenix及hbase repl命令行两种方式

    一.Phoenix(jdbc)登陆 1.cd /home/mr/phoenix/bin(此路径每个环境里面有可能不一样)2../sqlline.py localhost 二.shell repl Hb ...

  2. CodePlus 2017 12 月赛

    这场比赛跟个zz一样 div1卡在了同余方程上 心态崩了去做div2 然后被T1搞崩了 T1: 大模拟 比较像配平方程式 思路: 但是未知物质每种元素系数不能≥10 且不能为空 (如CO2+?=CO2 ...

  3. bzoj4753

    bzoj4753 树形dp+01分数规划 这是一个典型的树形背包+01分数规划.看见分数形式最大就应该想到01分数规划. 于是套用分数规划,每次用树形背包检验. 首先这是一棵树,不是一个森林,所以我们 ...

  4. astgo-完整功能介绍

    核心功能: Astgo最核心和强大的功能是呼叫中心模块.接入方式:中继卡.模拟卡接入,中继网关.O口网关接入.网络IP接入等.单机200个坐席,通话实时录音.灵活队列分组.开放式IVR设计,修改业务逻 ...

  5. codevs4511信息传递(Tarjan求环)

    题目描述 有n个同学(编号为1到n)正在玩一个信息传递的游戏.在游戏里每人都有一个固定的信息传递对象,其中,编号为i的同学的信息传递对象是编号为Ti同学. 游戏开始时,每人都只知道自己的生日.之后每一 ...

  6. SpringMVC+Jquery实现Ajax

    一.什么是Ajax? Ajax:异步的JavaScript和Json(这里XML改为了Json): 作用:用于完成网页局部刷新功能(修改少量数据只用局部刷新,不用再整个网页重新加载): 二.Sprin ...

  7. 题解报告:hdu 2647 Reward(拓扑排序)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2647 Problem Description Dandelion's uncle is a boss ...

  8. 1、Web MVC简介

  9. excel另存为csv

    # -*- coding: utf-8 -*- """ Created on Tue Jul 11 21:25:57 2017 import pandas as pd i ...

  10. [转]android 获取 imei号码

    核心代码: Imei = ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)) .getDeviceId(); 1.加入权限 在manife ...