$Session_Open

From m204wiki
Revision as of 22:48, 6 October 2015 by JAL (talk | contribs) (misc cleanup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Open a session

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Session_Open function is GetSession.

$Session_Open opens a previously created session.

Syntax

%rc = $Session_Open(sesid, [owner], [timeout])

%rc A returned zero, indicating success, or a number indicating the cause of error, if there is one.
sesid The ID of the session to be opened. This is a required argument.
owner The userid that owns the session to be opened. An owner value of asterisk (*) means that the session is public, that is available to all users.

This optional argument defaults to the creating user's userid.

timeout The time to wait for an in-use session to be closed before giving up. A value of -1 indicates to use the value of the SRSDEFTO parameter. This argument defaults to -1, that is, the value of the SRSDEFTO parameter.

Return codes

%rc is set to 0 or to an error indicator.

0 - No errors 1 - Session not found 2 - Session in use

Usage notes

Use of a non-zero timeout for $Session_Open can be useful for single-threading multiple threads through a request or for dealing with timing problems where it's possible for a request for a session to come in before the previous one is completely done. This is quite possible in Janus Web Server applications where one of these occurs:

  • A request resulting from a redirect comes in before the redirecting thread has closed the session
  • A user cancels a request and then resubmits it while the original request is still processing and so has the session open.

Example

The following retrieves a session ID from a cookie and opens it:

%sesid = $Web_Get_Cookie('SESID') %rc = $Session_Open(%sesid)

Products authorizing $Session_Open