Server Module - StartSession Method

Start a session

Member of Server Module (PRIM_SRVM)


NameTypeData TypeDescription
Timeout*Input (Optional)IntegerNumber 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.

Allowed Values

Enum ValueDescription
>1Timeout in seconds
0Use the global default as defined in the Data/Application Server configuration
-1The 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
         #Result := ER
   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
   Srvroutine Name(Signoff) Session(*Required)

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020