diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-A30C1204-F130-501E-BD2D-1EE1537BEFC3.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-A30C1204-F130-501E-BD2D-1EE1537BEFC3.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,99 @@ + + + + + +How +to implement a client interface with subsessionsProvides code snippets to help you to implement a +client interface with subsessions. +

A client side subsession is represented by an instance of a class derived +from RSubSessionBase which provides the behaviour for:

+ +

In the following code fragment, taken from the example that can be found +at ...\examples\Base\IPC\ClientServer\complex, the class RCountSubSession, +derived from RSubSessionBase, represents the client side +subsession with a server (in the example the server is also referred to as +the count server). The assumption is made that the client has already established +a session with the server as represented by the RCountSession class.

+class RCountSubSession : public RSubSessionBase + { +public: + TInt Open(RCountSession& aServer); + TInt SetFromString(const TDesC& aString); + void Close(); + void Increase(); + void Decrease(); + void IncreaseBy(TInt anInt); + void DecreaseBy(TInt anInt); + void Reset(); + TInt CounterValue(); + }; + +class RCountSession : public RSessionBase + { +public: + RCountSession(); + TInt Connect(); + TVersion Version() const; + TInt ResourceCount(); + void Close(); +private: + RThread iServerThread; + }; +

The important points in this example are:

+ + +
Notes
    +
  • The operation code passed +to RSubSessionBase::CreateSubSession() must be interpreted +by the server as a request to create a subsession.

  • +
  • When sending a message +to the server with a call to RSubSessionBase::SendReceive(), +only three arguments can be passed . This function always uses the fourth +argument to hold the client subsession handle number which is used to identify +the corresponding server side subsession object. The message arguments are +subsequently passed to a call to RSessionBase::SendReceive().

  • +
  • The operation code passed +to RSubSessionBase::CloseSubSession() must be interpreted +by the server as a request to close the subsession.

  • +
+
\ No newline at end of file