nn::nex::Session::CreateOrJoinSession Member Function

Syntax

static qBool CreateOrJoinSession(
     void(*)() pfCreateCallback = NULL,
     SessionDescription *(*)(qList< SessionDescription > &lstSessions) pfSessionSelection = NULL
);

Parameters

Name Description
in pfCreateCallback Specifies the callback function to call when creating a session (default is NULL). If an existing object in the DDL (Data Definition Language) is already defined, you must create all existing objects inside this callback function. You can also use this function to set session descriptor SessionDescription information before a session is created.
in pfSessionSelection Specifies the callback function used to determine which session to join when multiple sessions have been found. If this pointer is NULL (default), Net-Z automatically joins the first session found.

Return Values



Value Description
true Returned when a session is successfully joined or created.
false Returned if participation or creation of a session failed, or if an error has occurred. SYSTEMERROR_DC_CLUSTER_JOIN_DENIED is signaled if internal Net-Z authentication fails. SYSTEMERROR_OBJDUP_WKHANDLE_WERE_CREATED is signaled if an existing object was created when attempting to join a found session. (Only the session master can create an existing object.) SYSTEMERROR_OBJDUP_WKHANDLE_NOT_INITIALIZED is signaled if an existing object was not created when attempting to create a session rather than find one. (An existing object must be created when creating a session.) SYSTEMERROR_DC_CLUSTER_REDEFINITION is signaled when an attempt is made to join or create multiple sessions.

Description

Tries to join an existing session, or creates a new session if no sessions are found.

This function is a wrapper to the three functions: QuerySessions, JoinSession, and CreateSession. When this function is called, it enumerates sessions created by processes connected to the same access point. It works like the QuerySessions function in this respect. If found, which session is joined is determined by the pfSessionSelection callback.If a session is found, and the session to join is decided, the session is joined just as with the JoinSession function.

If processes connected to the same access point have not opened a session, the device executing this function becomes the parent, and the session is created as it is using CreateSession. Before a session is created, the callback function specified by the pfCreateCallback function is called.

Note: This function was designed for debugging. Do not use this function in product releases.

See Also

QuerySessions, JoinSession, CreateSession

Revision History

2011/01/27
Initial version.

CONFIDENTIAL