Symbian3/SDK/Source/GUID-C1612638-4C5A-5C37-AF1A-16F9EBEF09FD.dita
changeset 13 48780e181b38
parent 7 51a74ef9ed63
equal deleted inserted replaced
12:80ef3a206772 13:48780e181b38
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE reference
    10 <!DOCTYPE reference
    11   PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
    12 <reference id="GUID-C1612638-4C5A-5C37-AF1A-16F9EBEF09FD" xml:lang="en"><title>transient:
    12 <reference id="GUID-C1612638-4C5A-5C37-AF1A-16F9EBEF09FD" xml:lang="en"><title>transient: transient server example</title><shortdesc>This example demonstrates the use of transient servers
    13 transient server example</title><shortdesc>This example demonstrates the use of transient servers that are
    13 that are started on demand when a client needs to use the server,
    14 started on demand when a client needs to use the server, and exit after the
    14 and exit after the last client has disconnected, sometimes after a
    15 last client has disconnected, sometimes after a short delay. It demonstrates
    15 short delay. It demonstrates how to handle startup and shutdown situations
    16 how to handle startup and shutdown situations correctly. </shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody>
    16 correctly. </shortdesc><prolog><metadata><keywords/></metadata></prolog><refbody>
    17 <section id="GUID-BF4C4CB4-D495-49D6-8035-F8BA724851B7"><title>Class summary</title><ul>
    17 <section id="GUID-BF4C4CB4-D495-49D6-8035-F8BA724851B7"><title>Class
    18 <li><p><xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita"><apiname>RSessionBase</apiname></xref> - Client-side handle to a session with
    18 summary</title><ul>
    19 a server.</p></li>
    19 <li><p><xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita"><apiname>RSessionBase</apiname></xref> - Client-side handle to a session
       
    20 with a server.</p></li>
    20 <li><p><xref href="GUID-5733DF34-5B54-3044-BBED-3BFECB7ACE7A.dita"><apiname>CTimer</apiname></xref> - Base class for a timer active object.</p></li>
    21 <li><p><xref href="GUID-5733DF34-5B54-3044-BBED-3BFECB7ACE7A.dita"><apiname>CTimer</apiname></xref> - Base class for a timer active object.</p></li>
    21 <li><p><xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref> - Abstract base class for servers (version
    22 <li><p><xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref> - Abstract base class for servers
    22 2).</p></li>
    23 (version 2).</p></li>
    23 <li><p><xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref> - Represents a session (version 2) for
    24 <li><p><xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref> - Represents a session (version
    24 a client thread on the server-side.</p></li>
    25 2) for a client thread on the server-side.</p></li>
    25 </ul></section>
    26 </ul></section>
    26 <section id="GUID-E688F8C0-0A4A-4D25-B7B4-779CB6A08157"><title>Download</title> <p>Click
    27 <section id="GUID-E688F8C0-0A4A-4D25-B7B4-779CB6A08157"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-cbf7e18e-3788-4ec1-a225-268ce1a22c51.zip" scope="external">transient.zip</xref></p><p>click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-cbf7e18e-3788-4ec1-a225-268ce1a22c51.html" scope="peer">browse</xref> to view the example code.</p> </section>
    27 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-cbf7e18e-3788-4ec1-a225-268ce1a22c51.zip" scope="external">transient.zip</xref></p><p>click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-cbf7e18e-3788-4ec1-a225-268ce1a22c51.html" scope="peer">browse</xref> to view the example code.</p> </section>
    28 <section id="GUID-87B18963-ACE8-464B-9863-A37ADA57379C"><title>Background</title> <p>The client-server framework is an important part of the Symbian
    28 <section id="GUID-87B18963-ACE8-464B-9863-A37ADA57379C"><title>Background</title> <p>The
    29 platform. There is a level of complexity in implementing a server
    29 client-server framework is an important part of the Symbian platform. There
    30 for an application, but this example provides client interface code
    30 is a level of complexity in implementing a server for an application, but
    31 and server code that can be re-used in your own implementations. </p> <p>Symbian platform servers are of three basic types: </p> <ul>
    31 this example provides client interface code and server code that can be re-used
    32 <li id="GUID-6D0F8C69-CFEA-5BB1-A0CB-C4D178DFAE25"><p> <b>Transient
    32 in your own implementations. </p> <p>Symbian platform servers are of three
    33 servers:</b> these are started on demand when a client needs the server,
    33 basic types: </p> <ul>
    34 and exit after the last client has disconnected - sometimes after
    34 <li id="GUID-6D0F8C69-CFEA-5BB1-A0CB-C4D178DFAE25"><p> <b>Transient servers:</b> these
    35 a short delay, for example, the socket server. </p> </li>
    35 are started on demand when a client needs the server, and exit after the last
    36 <li id="GUID-5B824584-C8E6-57F7-A83C-564DA256F622"><p> <b>System servers:</b> these are started as part of the system boot process, for example,
    36 client has disconnected - sometimes after a short delay, for example, the
    37 the kernel, the file server, the window server etc. </p> </li>
    37 socket server. </p> </li>
    38 <li id="GUID-9BE0FD09-B112-5AF6-A5D1-FBDD6A4EC00B"><p> <b>Local servers:</b> these are "local" to a process to provide multi-threaded access
    38 <li id="GUID-5B824584-C8E6-57F7-A83C-564DA256F622"><p> <b>System servers:</b> these
    39 to thread-specific resources, for example, the posix server (in the
    39 are started as part of the system boot process, for example, the kernel, the
    40 C Standard Library). </p> </li>
    40 file server, the window server etc. </p> </li>
       
    41 <li id="GUID-9BE0FD09-B112-5AF6-A5D1-FBDD6A4EC00B"><p> <b>Local servers:</b> these
       
    42 are "local" to a process to provide multi-threaded access to thread-specific
       
    43 resources, for example, the posix server (in the C Standard Library). </p> </li>
       
    44 </ul> </section>
    41 </ul> </section>
    45 <section id="GUID-EEA0A38B-F8A6-4308-A50D-B3E74B12420A"><title>Description</title> <p>The
    42 <section id="GUID-EEA0A38B-F8A6-4308-A50D-B3E74B12420A"><title>Description</title> <p>The transient server supplied here runs in a thread in its own
    46 transient server supplied here runs in a thread in its own process. This gives
    43 process. This gives the server independence from its clients. This
    47 the server independence from its clients. This is important because if the
    44 is important because if the client were to create the server as a
    48 client were to create the server as a separate thread within its own process,
    45 separate thread within its own process, then the server would exit,
    49 then the server would exit, i.e. terminate, if its owning process terminated.
    46 i.e. terminate, if its owning process terminated. This would be true
    50 This would be true even if clients in other processes were still connected
    47 even if clients in other processes were still connected to it. </p> <p>Equally as important: </p> <ul>
    51 to it. </p> <p>Equally as important: </p> <ul>
    48 <li id="GUID-432FCF7B-2393-5E59-BDE5-0A5B4BAFD155"><p>a client does
    52 <li id="GUID-432FCF7B-2393-5E59-BDE5-0A5B4BAFD155"><p>a client does not explicitly
    49 not explicitly need to start the server prior to connecting; this
    53 need to start the server prior to connecting; this is done by the client interface. </p> </li>
    50 is done by the client interface. </p> </li>
    54 <li id="GUID-D89C8F48-2CA2-5769-8DB9-42FD8FFA5879"><p>the server terminates
    51 <li id="GUID-D89C8F48-2CA2-5769-8DB9-42FD8FFA5879"><p>the server terminates
    55 when not in use shortly after the last client disconnects. </p> </li>
    52 when not in use shortly after the last client disconnects. </p> </li>
    56 <li id="GUID-968AB243-908B-5709-BB82-4213860CBC8A"><p>the code handles concurrency
    53 <li id="GUID-968AB243-908B-5709-BB82-4213860CBC8A"><p>the code handles
    57 issues, the most common of which is handling the case where the server is
    54 concurrency issues, the most common of which is handling the case
    58 closing down or exiting at the same time that another client is trying to
    55 where the server is closing down or exiting at the same time that
    59 connect. </p> </li>
    56 another client is trying to connect. </p> </li>
    60 </ul> <p>The example consists of four main parts: </p> <ul>
    57 </ul> <p>The example consists of four main parts: </p> <ul>
    61 <li id="GUID-BC6A15E0-07CB-562C-99E8-0AAF39B0ED26"><p>Client interface: this
    58 <li id="GUID-BC6A15E0-07CB-562C-99E8-0AAF39B0ED26"><p>Client interface:
    62 is a DLL (<filepath>t-client.dll</filepath>) that is used by clients. </p> <p>The
    59 a DLL (<filepath>t-client.dll</filepath>) that is used by clients. </p> <p>The client interface effectively forms the gateway to the server.
    63 client interface effectively forms the gateway to the server. All requests
    60 All requests to the server, including requests to connect to it are
    64 to the server, including requests to connect to it are routed through this. </p> <p>The
    61 routed through this. </p> <p>The client interface defines just one
    65 client interface defines just one class: <codeph>RMySession</codeph>, derived
    62 class: <codeph>RMySession</codeph>, derived from <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita"><apiname>RSessionBase</apiname></xref>. An <codeph>RSessionBase</codeph> (derived) object represents the
    66 from <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita"><apiname>RSessionBase</apiname></xref>. An <codeph>RSessionBase</codeph> (derived)
    63 client side session and forms a channel of communication between the
    67 object represents the client side session and forms a channel of communication
    64 client and the server. Requests to the server, and information received
    68 between the client and the server. Requests to the server, and information
    65 from the server are channelled through this object. Note that the
    69 received from the server are channelled through this object. Note that the
    66 client side session object is mirrored by a server side session object;
    70 client side session object is mirrored by a server side session object; an
    67 an instance of a class derived from <xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref>,
    71 instance of a class derived from <xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref>, which in this
    68 which in this server is called <codeph>CMySession</codeph>. </p> <p>The client calls <codeph>Connect()</codeph> to set up a connection
    72 server is called <codeph>CMySession</codeph>. </p> <p>The client calls <codeph>Connect()</codeph> to
    69 to the server. This function attempts to start the server if necessary
    73 set up a connection to the server. This function attempts to start the server
    70 and then issues a request to create a session with the server. If
    74 if necessary and then issues a request to create a session with the server.
    71 the server fails to start, or a session cannot be created then this
    75 If the server fails to start, or a session cannot be created then this is
    72 is reported back.Simultaneous launching of two server processes is
    76 reported back.Simultaneous launching of two server processes is also detected,
    73 also detected, with the second attempt failing with <xref href="GUID-D1D25122-F2B8-3C78-8599-84905BFD47B8.dita"><apiname>KErrAlreadyExists</apiname></xref>. On successful completion the connection is established, and a session
    77 with the second attempt failing with <xref href="GUID-D1D25122-F2B8-3C78-8599-84905BFD47B8.dita"><apiname>KErrAlreadyExists</apiname></xref>.
    74 is created with the server. </p> <p>The client uses the <codeph>Send()</codeph> method to send messages to the server and the <codeph>Receive()</codeph> method to request information from the server. <codeph>Send()</codeph> is implemented by calling down to the synchronous variant of <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref> in the base class. Synchronous
    78 On successful completion the connection is established, and a session is created
    75 means that it does not return until the server has dealt with the
    79 with the server. </p> <p>The client uses the <codeph>Send()</codeph> method
    76 request. </p> <p> <codeph>Send()</codeph> passes an operation code
    80 to send messages to the server and the <codeph>Receive()</codeph> method to
    77 (or function number) identifying the request and a descriptor containing
    81 request information from the server. <codeph>Send()</codeph> is implemented
    78 information to the server. The descriptor is wrapped into a <xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> object. In practice, your client interface would
    82 by calling down to the synchronous variant of <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref> in
    79 probably be richer, having variants of the <codeph>Send()</codeph> function that take more than one parameter. You might also choose
    83 the base class. Synchronous means that it does not return until the server
    80 to have asynchronous variants of <codeph>Send()</codeph>; your client
    84 has dealt with the request. </p> <p> <codeph>Send()</codeph> passes an operation
    81 code (not the client interface) would then need to use active objects
    85 code (or function number) identifying the request and a descriptor containing
    82 to deal with this. </p> <p> <codeph>Receive()</codeph> is implemented
    86 information to the server. The descriptor is wrapped into a <xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> object.
    83 by calling down to the asynchronous variant of <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref> in the base class. Asynchronous means that the call returns immediately,
    87 In practice, your client interface would probably be richer, having variants
    84 but the request itself may not complete until some time later. </p> <p> <codeph>Receive()</codeph> passes an operation code (or function
    88 of the <codeph>Send()</codeph> function that take more than one parameter.
    85 number) identifying the request, a descriptor into which the server
    89 You might also choose to have asynchronous variants of <codeph>Send()</codeph>;
    86 will place the information, and a <xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> object, which the server will use to report how the request completes.
    90 your client code (not the client interface) would then need to use active
    87 The descriptor is wrapped into a <xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> object.
    91 objects to deal with this. </p> <p> <codeph>Receive()</codeph> is implemented
    88 Again, you might want a richer client interface; perhaps different
    92 by calling down to the asynchronous variant of <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref> in
    89 function names to represent different request types. </p> <p> <codeph>CancelReceive()</codeph> allows the client to cancel a pending <codeph>Receive()</codeph> request. It is usual to provide some mechanism
    93 the base class. Asynchronous means that the call returns immediately, but
    90 to cancel asynchronous requests. This is implemented by calling down
    94 the request itself may not complete until some time later. </p> <p> <codeph>Receive()</codeph> passes
    91 into the asynchronous variant of <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref> in the base class. Note: the <codeph>Receive()</codeph> method simply
    95 an operation code (or function number) identifying the request, a descriptor
    92 passes an operation code (or function number) and no data. </p> <p>The operation codes (or function numbers) are defined by an enum
    96 into which the server will place the information, and a <xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> object,
    93 in the header file <filepath>clientserver.h</filepath>. This file
    97 which the server will use to report how the request completes. The descriptor
    94 is included in both the client interface code and server code as both
    98 is wrapped into a <xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> object. Again, you might want
    95 need access to these common symbols. </p> </li>
    99 a richer client interface; perhaps different function names to represent different
    96 <li id="GUID-A76A5A09-CB86-5D58-8771-3DE4131E51B9"><p>Server: an EXE
   100 request types. </p> <p> <codeph>CancelReceive()</codeph> allows the client
    97 (<filepath>t-server.exe</filepath>) that runs in its own process,
   101 to cancel a pending <codeph>Receive()</codeph> request. It is usual to provide
    98 and E32Main() is the entry point. After setting up heap checking (in
   102 some mechanism to cancel asynchronous requests. This is implemented by calling
    99 debug builds only) the implementation creates a cleanup stack and
   103 down into the asynchronous variant of <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref> in
   100 then executes the main body of the code inside a trap harness. </p> <p>The server code implements several classes: </p> <p> <codeph>CMyServer</codeph>: this class derives from the class <xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref>. The main role of this class is to handle messages sent by client
   104 the base class. Note: the <codeph>Receive()</codeph> method simply passes
   101 threads; this includes requests from clients for connection to the
   105 an operation code (or function number) and no data. </p> <p>The operation
   102 server. The connection is established by starting a session with the
   106 codes (or function numbers) are defined by an enum in the header file <filepath>clientserver.h</filepath>.
   103 server. The session is represented by a session object, in this case
   107 This file is included in both the client interface code and server code as
   104 the <xref href="GUID-8B50E9C7-CA33-3E11-A881-16E230A082CB.dita"><apiname>CMySession</apiname></xref> object. </p> <p>Once the <codeph>CMyServer</codeph> object has been created, the active scheduler
   108 both need access to these common symbols. </p> </li>
   105 can be started by the call to <xref href="GUID-B4C76104-EA1B-3FC3-A31E-86A976598171.dita#GUID-B4C76104-EA1B-3FC3-A31E-86A976598171/GUID-3281C85C-1A45-3049-B711-64CA8BFBC452"><apiname>CActiveScheduler::Start()</apiname></xref>. This call will not return until the active scheduler is stopped
   109 <li id="GUID-A76A5A09-CB86-5D58-8771-3DE4131E51B9"><p>Server: this is an EXE
   106 by the <codeph>CShutdown</codeph> timer, which is primed after the
   110 (<filepath>t-server.exe</filepath>) that runs in its own process, and E32Main()
   107 last client has disconnected. In simple terms, the active scheduler
   111 is the entry point. After setting up heap checking (in debug builds only)
   108 is a wait loop. It sits inactive until it receives a message from
   112 the implementation creates a cleanup stack and then executes the main body
   109 (potential) clients (or until the timer completes and stops the active
   113 of the code inside a trap harness. </p> <p>The server code implements several
   110 scheduler). Messages that represent requests for connection result
   114 classes: </p> <p> <codeph>CMyServer</codeph>: this class derives from the
   111 in the creation of a session. Other messages are passed to the relevant <codeph>CMySession</codeph> active object. </p> <p> <codeph> CMySession</codeph>: one of these objects is created for each session, i.e. as a result
   115 class <xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref>. The main role of this class is to handle
   112 of a request by a client for connection to the server. Once sessions
   116 messages sent by client threads; this includes requests from clients for connection
   113 have been created, requests received by <codeph>CMyServer</codeph> are then forwarded to the corresponding session, and specifically
   117 to the server. The connection is established by starting a session with the
   114 to the virtual function <codeph>ServiceL()</codeph>, which handles <codeph>Send()</codeph>, <codeph>Receive()</codeph> and <codeph>CancelReceive()</codeph> requests. </p> <p> <codeph>CShutdown</codeph>: this class represents
   118 server. The session is represented by a session object, in this case the <xref href="GUID-8B50E9C7-CA33-3E11-A881-16E230A082CB.dita"><apiname>CMySession</apiname></xref> object. </p> <p>Once
   115 a timer that is started before the first client has connected, and
   119 the <codeph>CMyServer</codeph> object has been created, the active scheduler
   116 after the last client has disconnected. The timer is stopped once
   120 can be started by the call to <xref href="GUID-B4C76104-EA1B-3FC3-A31E-86A976598171.dita#GUID-B4C76104-EA1B-3FC3-A31E-86A976598171/GUID-3281C85C-1A45-3049-B711-64CA8BFBC452"><apiname>CActiveScheduler::Start()</apiname></xref>.
   117 the server has at least one client attached to it. If the server has
   121 This call will not return until the active scheduler is stopped by the <codeph>CShutdown</codeph> timer,
   118 no clients, then there is 2 second interval before the server terminates.
   122 which is primed after the last client has disconnected. In simple terms, the
   119 This is implemented as an active object. </p> </li>
   123 active scheduler is a wait loop. It sits inactive until it receives a message
   120 <li id="GUID-07B2ACEC-C457-547D-B1FE-78FCF980AEEF"><p>Test code: corresponds
   124 from (potential) clients (or until the timer completes and stops the active
   121 to the client, and uses the client interface to communicate with the
   125 scheduler). Messages that represent requests for connection result in the
   122 server - application developers should make use of the principles
   126 creation of a session. Other messages are passed to the relevant <codeph>CMySession</codeph> active
   123 applied here and include them into their own client code. </p> </li>
   127 object. </p> <p> <codeph> CMySession</codeph>: one of these objects is created
   124 <li id="GUID-91B89143-B380-524D-89CF-918FAE5CE055"><p>bld.inf: a component
   128 for each session, i.e. as a result of a request by a client for connection
   125 description file. </p> </li>
   129 to the server. Once sessions have been created, requests received by <codeph>CMyServer</codeph> are
       
   130 then forwarded to the corresponding session, and specifically to the virtual
       
   131 function <codeph>ServiceL()</codeph>, which handles <codeph>Send()</codeph>, <codeph>Receive()</codeph> and <codeph>CancelReceive()</codeph> requests. </p> <p> <codeph>CShutdown</codeph>: this class represents a timer that is started
       
   132 before the first client has connected, and after the last client has disconnected.
       
   133 The timer is stopped once the server has at least one client attached to it.
       
   134 If the server has no clients, then there is 2 second interval before the server
       
   135 terminates. This is implemented as an active object. </p> </li>
       
   136 <li id="GUID-07B2ACEC-C457-547D-B1FE-78FCF980AEEF"><p>Test code:this corresponds
       
   137 to the client, and uses the client interface to communicate with the server
       
   138 - application developers should make use of the principles applied here and
       
   139 include them into their own client code. </p> </li>
       
   140 <li id="GUID-91B89143-B380-524D-89CF-918FAE5CE055"><p>bld.inf: which is a
       
   141 component description file. </p> </li>
       
   142 </ul><p><b>Related APIs</b></p><ul>
   126 </ul><p><b>Related APIs</b></p><ul>
   143 <li><p><xref href="GUID-B4C76104-EA1B-3FC3-A31E-86A976598171.dita#GUID-B4C76104-EA1B-3FC3-A31E-86A976598171/GUID-3281C85C-1A45-3049-B711-64CA8BFBC452"><apiname>CActiveScheduler::Start()</apiname></xref></p></li>
   127 <li><p><xref href="GUID-B4C76104-EA1B-3FC3-A31E-86A976598171.dita#GUID-B4C76104-EA1B-3FC3-A31E-86A976598171/GUID-3281C85C-1A45-3049-B711-64CA8BFBC452"><apiname>CActiveScheduler::Start()</apiname></xref></p></li>
   144 <li><p><xref href="GUID-8B50E9C7-CA33-3E11-A881-16E230A082CB.dita"><apiname>CMySession</apiname></xref></p></li>
   128 <li><p><xref href="GUID-8B50E9C7-CA33-3E11-A881-16E230A082CB.dita"><apiname>CMySession</apiname></xref></p></li>
   145 <li><p><xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref> - Abstract base class for servers (version
   129 <li><p><xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref> - Abstract base class for servers
   146 2).</p></li>
   130 (version 2).</p></li>
   147 <li><p><xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref> - Represents a session (version 2) for
   131 <li><p><xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref> - Represents a session (version
   148 a client thread on the server-side.</p></li>
   132 2) for a client thread on the server-side.</p></li>
   149 <li><p><xref href="GUID-D1D25122-F2B8-3C78-8599-84905BFD47B8.dita"><apiname>KErrAlreadyExists</apiname></xref> - System wide error code -11 :
   133 <li><p><xref href="GUID-D1D25122-F2B8-3C78-8599-84905BFD47B8.dita"><apiname>KErrAlreadyExists</apiname></xref> - System wide error code
   150 an object already exists.</p></li>
   134 -11 : an object already exists.</p></li>
   151 <li><p><xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita"><apiname>RSessionBase</apiname></xref> - Client-side handle to a session with
   135 <li><p><xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita"><apiname>RSessionBase</apiname></xref> - Client-side handle to a session
   152 a server.</p></li>
   136 with a server.</p></li>
   153 <li><p><xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref></p></li>
   137 <li><p><xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita#GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6/GUID-479FE087-DD9F-31D7-98F7-9F96535F0584"><apiname>RSessionBase::SendReceive()</apiname></xref></p></li>
   154 <li><p><xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> - A Version 2 client/server class that
   138 <li><p><xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> - A Version 2 client/server class
   155 clients use to package the arguments to be sent to a server.</p></li>
   139 that clients use to package the arguments to be sent to a server.</p></li>
   156 <li><p><xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> - Indicates the completion status
   140 <li><p><xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> - Indicates the completion
   157 of a request made to a service provider.</p></li>
   141 status of a request made to a service provider.</p></li>
   158 </ul> </section>
   142 </ul> </section>
   159 <section id="GUID-86D3479E-216B-4D5D-AF57-C4C9963CD9F0"><title>Building and
   143 <section id="GUID-86D3479E-216B-4D5D-AF57-C4C9963CD9F0"><title>Building
   160 configuring</title> <p>To build the example: </p> <ul>
   144 and configuring</title> <p>To build the example: </p> <ul>
   161 <li id="GUID-FDC690A6-D68B-58E5-A10D-89220DB9B89E"><p>You can build the example
   145 <li id="GUID-FDC690A6-D68B-58E5-A10D-89220DB9B89E"><p>You can build
   162 from your IDE or the command line. </p> <p>If you use an IDE, import the <filepath>bld.inf</filepath> file
   146 the example from your IDE or the command line. </p> <p>If you use
   163 of the example into your IDE, and use the build command of the IDE. </p> <p>If
   147 an IDE, import the <filepath>bld.inf</filepath> file of the example
   164 you use the command line, open a command prompt, and set the current directory
   148 into your IDE, and use the build command of the IDE. </p> <p>If you
   165 to the source code directory of the example. You can then build the example
   149 use the command line, open a command prompt, and set the current directory
   166 with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake
   150 to the source code directory of the example. You can then build the
   167 bldfiles</userinput> </p> <p><userinput>abld build</userinput> </p> <p><xref href="GUID-793A5EF9-CC16-5EEB-9011-6431EA76EB15.dita">How to use bldmake</xref> and <xref href="GUID-B6B54E07-3B34-5D5C-8815-93383FA8FB4B.dita">How to use abld</xref> describe
   151 example with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake bldfiles</userinput> </p> <p><userinput>abld
   168 how to use the SBSv1 build tools. </p> </li>
   152 build</userinput> </p> </li>
   169 <li id="GUID-DD18F4AF-6AB1-5E0F-95C3-9EB899BA99C9"><p>For the emulator, the
   153 <li id="GUID-DD18F4AF-6AB1-5E0F-95C3-9EB899BA99C9"><p>For the emulator,
   170 example builds the following executables : </p> <p> <filepath>t-client.dll</filepath> </p> <p> <filepath>t-server.exe</filepath>  </p> <p> <filepath>t-test.exe</filepath> (test executable) </p> <p> <filepath>t-testc.dll</filepath> (test
   154 the example builds the following executables : </p> <p> <filepath>t-client.dll</filepath> </p> <p> <filepath>t-server.exe</filepath>  </p> <p> <filepath>t-test.exe</filepath> (test executable) </p> <p> <filepath>t-testc.dll</filepath> (test client) </p> <p>in the <filepath>epoc32\release\winscw\&lt;udeb or urel&gt;\</filepath> folder. </p> </li>
   171 client) </p> <p>in the <filepath>epoc32\release\winscw\&lt;udeb or urel&gt;\</filepath> folder. </p> </li>
       
   172 </ul> </section>
   155 </ul> </section>
   173 </refbody><related-links>
   156 </refbody><related-links>
   174 <link href="GUID-4BFEDD79-9502-526A-BA7B-97550A6F0601.dita"><linktext>Platform
   157 <link href="GUID-4BFEDD79-9502-526A-BA7B-97550A6F0601.dita"><linktext>Platform
   175 security</linktext></link>
   158 security</linktext></link>
   176 <link href="GUID-B21141D4-3BFE-59C9-8D5F-147A93BE1C95.dita"><linktext>Build tools
       
   177 guide</linktext></link>
       
   178 <link href="GUID-594488FF-02C9-5066-85DB-5F88A754AE18.dita"><linktext>How     
       
   179            to build DLLs</linktext></link>
       
   180 <link href="GUID-BBBB5000-90A2-503A-9521-2FC6DEC69DC8.dita"><linktext>MMP file
       
   181 syntax</linktext></link>
       
   182 </related-links></reference>
   159 </related-links></reference>