Start a session
Member of Server Module (PRIM_SRVM)
Name | Type | Data Type | Description |
---|---|---|---|
Timeout | *Input (Optional) | Integer | Number of seconds of inactivity before the session ends |
The StartSession method is used to create a new session. SrvRoutines defined with Session(*Required) will fail is there is no valid session. Attempting to run one will result in the Failed event firing on the client. By default, a session will timeout if there is no activity for 300 seconds. The Timeout parameter can be used to override this default.
Enum Value | Description |
---|---|
>1 | Timeout in seconds |
0 | Use the global default as defined in the Data/Application Server configuration |
-1 | The session will never timeout |
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
Febuary 18 V14SP2