Terminate the session |
Member of Server Module (PRIM_SRVM)
The EndSession method is used to terminate the current session.
SrvRoutines defined with Session(*Required) will no longer be able to execute. Attempting to run one will result in the Failed event firing on the client.
This example shows a simple session Server Module with routines for signing on and off.
A SessionIdentifier(PRIM_SRVM) is specified so that Server Module can be used in conjunction with other modules and can shared persisted data.
Begin_Com Role(*EXTENDS #PRIM_SRVM) SessionIdentifier(Personnel)
Define Field(#gUserID) Type(*Char) Length(40)
Persist Fields(#gUserID)
Srvroutine Name(Signin)
Field_Map For(*Input) Field(#User)
Field_Map For(*Output) Field(#Result)
If (#Com_owner.VerifyUser( #User ))
#Com_owner.StartSession Timeout(240)
#Result := OK
#gUserID := #User
Else
#Result := ER
Endif
Endroutine
Mthroutine Name(VerifyUser) Access(*Private)
Define_Map For(*Input) Class(#xDemoAlpha128) Name(#User)
Define_Map For(*Result) Class(#xDemoBoolean) Name(#Result)
* Test for a valid user
Endroutine
Srvroutine Name(Signoff) Session(*Required)
#Com_owner.EndSession
Endroutine
End_Com