在DataSnap中,是否可以检测TCP连接是否已关闭,因为已达到保持活动的时间或仅与客户端正常断开连接?
procedure TsrvService.DSTCPServerTransport1Connect(
Event: TDSTCPConnectEventObject);
begin
Writeln('Connect from ', Event.Channel.ChannelInfo.ClientInfo.IpAddress);
Event.Channel.EnableKeepAlive(10000, 100);
end;
procedure TsrvService.DSTCPServerTransport1Disconnect(
Event: TDSTCPDisconnectEventObject);
begin
Writeln('Disconnect : ', TIdTcpConnection(Event.Connection).Socket.Binding.PeerIP);
// Keep-Alive Timeout or any other reason for disconnect???
// Log('Keep-Alive Timeout for host...');
end;