http://blog.youkuaiyun.com/beiguofengguang/article/details/7578056
delphi盒子sdhzth(通慧):
delphi xe2下的datasnap心跳包设置
1、在servercontainer文件中,先增加一个private变量,
FConnections:TDictionary<TIdTCPConnection,TDSTCPChannel>;
2、在servercontainer1.datamoduleCreate(Sender:Tobject)中添加:
FConnections:=TDictionary<TIdTCPConnection,TDSTCPChannel>.Create;
3、在servercontainer1.DSTCPServerTransport1Connect中添加:
FConnections.Add(TIdTCPConnection(Event.Connection), Event.Channel);
Event.Channel.EnableKeepAlive(10000);//心跳包设置为10秒
4、在servercontainer1.DSTCPServerTransport1Disconnect中添加
FConnections.Remove(TIdTCPConnection(Event.Connection));
大家可以测试一下。
fiscan6430 (fiscan6430):将Transport的KeepAliveEnablement设置成kaEnabled,然后设置KeepAliveTime和KeepAliveInterval两个参数,如果意外断线的话,能够在Transport的Disconnect事件中获得。
http://bbs.2ccc.com/topic.asp?topicid=396438