njtz2011 Posted August 21, 2011 Share Posted August 21, 2011 I want to manually stop a session,but I can't find ways to achieve,The following code no effect. ASession := TUniGUISession(UniServerModule.SessionManager.Sessions.GetSession(SomeSessionID,SomeRemoteHost)); if ASession <> nil then ASession.UniApplication.Terminate; //or UniServerModule.ClearSessionBusy(ASession); Quote Link to comment Share on other sites More sharing options...
Tom Posted August 21, 2011 Share Posted August 21, 2011 Hi, try UniApplication.Restart; or UniApplication.Terminate; both routines will destory tmainmodule, wiche is representing a session. UniApplication is always valid and bound to sessions' context. Quote Link to comment Share on other sites More sharing options...
dalpiaze Posted August 22, 2011 Share Posted August 22, 2011 I want to manually stop a session,but I can't find ways to achieve,The following code no effect. ASession := TUniGUISession(UniServerModule.SessionManager.Sessions.GetSession(SomeSessionID,SomeRemoteHost)); if ASession <> nil then ASession.UniApplication.Terminate; //or UniServerModule.ClearSessionBusy(ASession); You can do the following: UniSession.Logout Remember that UniSession it's a function of "uniGUIApplication" unit that retrieves the current session. But if you are managing the sessions in "global" scope, first you have to get the TUniGUISession. So, you can do the following: uses ServerModule; procedure KillSession; var Sessions: TList; Session: TUniGUISession; I: Integer; begin Sessions := UniServerModule.SessionManager.Sessions.SessionList.LockList; try for I := 0 to Sessions.Count - 1 do begin Session := Sessions[i]; Secao.Lock; try if Session.(SessionID/IP/Address) = (????) then Session.Logout; finally Secao.Unlock; end; end; finally UniServerModule.SessionManager.Sessions.SessionList.UnlockList; end; end; Quote Link to comment Share on other sites More sharing options...
njtz2011 Posted August 23, 2011 Author Share Posted August 23, 2011 Thanks a lot! Quote Link to comment Share on other sites More sharing options...
fjtrooper Posted January 17, 2012 Share Posted January 17, 2012 Hello, I've tried to terminate/close sessions manually, and the user is dropped, but the connection to mysql is still active. It's like if the unimainmodule still alive. I use MyDac to connect to Mysql. THX Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted January 17, 2012 Administrators Share Posted January 17, 2012 Terminating a session terminates MainModule. Meybe Connections are cached internally. Quote Link to comment Share on other sites More sharing options...
fjtrooper Posted January 17, 2012 Share Posted January 17, 2012 Terminating a session terminates MainModule. Meybe Connections are cached internally. At first not.... I've tried closing sessions with diferent methos: session.uniapplication.terminate session.logout session.unimainmodule.terminate which should be the right one? THX Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted January 17, 2012 Administrators Share Posted January 17, 2012 uniapplication.terminate Quote Link to comment Share on other sites More sharing options...
fjtrooper Posted January 17, 2012 Share Posted January 17, 2012 Ok, thx, I'll try again with that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.