1.3.3.1 Establishing a Session
A session is established by making a nested series of synchronous remote procedure call (RPC) between the IXnRemote interfaces of the two partners. These calls are made in order; furthermore, no call begins before the last call completes, unless an error occurs.
Once one of the partners decides to establish a session, the sequence is as follows. If the primary partner decides to establish the session, it proceeds immediately. If the secondary partner decides to establish the session, it establishes an RPC connection to the primary partner and calls either the Poke method or the PokeW method, which has the effect of informing the primary that the secondary wants to establish a session. The primary partner begins the handshake series by establishing an RPC connection to the secondary partner, and by making a BuildContext call or BuildContextW call to the secondary partner. The secondary partner responds to the incoming call by making a corresponding BuildContext callback or BuildContextW callback to the primary (after establishing an RPC connection, if necessary).
The primary partner then verifies the callback, and the chain of procedure calls progresses. The primary partner returns from the BuildContext call or the BuildContextW call that was made by the secondary partner, and then the secondary partner returns from the BuildContext call or the BuildContextW call that was made by the primary. Once these calls have returned, the session has been established. The following sequence diagrams illustrate this process.
Figure 1: Session initiation by primary partner
Figure 2: Session initiation by secondary partner