I have a client application that is connecting to a DA server using IpSuperTcpClientChannel. Is there a way to detect when the server has disconnected the client following the timeout specified in MemorySessionManager.Timeout.
I’ve tried checking the following:
ClientChannel.Active - this is always true.
ClientChannel.Connected - this is always true.
ClientChannel.OnDisconnected - this never fires.
This is a .net client connecting to a .net server, I’m using Oxygene in both.
our templates suggest to use this implementation for this event:
method DataModule.ClientChannel_OnLoginNeeded(sender: Object; e: LoginNeededEventArgs);
begin
// Performing login
if self.LogOn(Properties.Settings.Default.UserId, Properties.Settings.Default.Password) then begin
e.Retry := true;
e.LoginSuccessful := true;
exit;
end;
var lUserId: String;
var lPassword: String;
using lLogOnForm: LogOnForm := new LogOnForm() do begin
if lLogOnForm.ShowDialog() <> DialogResult.OK then begin
MessageBox.Show('Login canceled');
exit;
end;
lUserId := lLogOnForm.UserId;
lPassword := lLogOnForm.Password;
end;
if self.LogOn(lUserId, lPassword) then begin
e.Retry := true;
e.LoginSuccessful := true;
end
else begin
MessageBox.Show('Login failed');
end;
end;
You can call [empty] server’s method from client in loop if you want to have persistent session. for example, call every 13 min if SessionManager.Timeout is set to 15 min