njtz2011 Posted August 21, 2011 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
Tom Posted August 21, 2011 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
dalpiaze Posted August 22, 2011 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
fjtrooper Posted January 17, 2012 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
Administrators Farshad Mohajeri Posted January 17, 2012 Administrators Posted January 17, 2012 Terminating a session terminates MainModule. Meybe Connections are cached internally. Quote
fjtrooper Posted January 17, 2012 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
Administrators Farshad Mohajeri Posted January 17, 2012 Administrators Posted January 17, 2012 uniapplication.terminate Quote
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.