21 <li><p><xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref> - Abstract base class for servers (version |
21 <li><p><xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref> - Abstract base class for servers (version |
22 2).</p></li> |
22 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 |
23 <li><p><xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref> - Represents a session (version 2) for |
24 a client thread on the server-side.</p></li> |
24 a client thread on the server-side.</p></li> |
25 </ul></section> |
25 </ul></section> |
26 <section id="GUID-E688F8C0-0A4A-4D25-B7B4-779CB6A08157"><title>Download</title> <p>Click on the following link to download |
26 <section id="GUID-E688F8C0-0A4A-4D25-B7B4-779CB6A08157"><title>Download</title> <p>Click |
27 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 |
28 <section id="GUID-87B18963-ACE8-464B-9863-A37ADA57379C"><title>Background</title> <p>The |
29 part of Symbian platform. There is a level of complexity in implementing a |
29 client-server framework is an important part of the Symbian platform. There |
30 server 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 |
31 this example provides client interface code and server code that can be re-used |
32 platform servers are of three basic types: </p> <ul> |
32 in your own implementations. </p> <p>Symbian platform servers are of three |
|
33 basic types: </p> <ul> |
33 <li id="GUID-6D0F8C69-CFEA-5BB1-A0CB-C4D178DFAE25"><p> <b>Transient servers:</b> these |
34 <li id="GUID-6D0F8C69-CFEA-5BB1-A0CB-C4D178DFAE25"><p> <b>Transient servers:</b> these |
34 are started on demand when a client needs the server, and exit after the last |
35 are started on demand when a client needs the server, and exit after the last |
35 client has disconnected - sometimes after a short delay, for example, the |
36 client has disconnected - sometimes after a short delay, for example, the |
36 socket server. </p> </li> |
37 socket server. </p> </li> |
37 <li id="GUID-5B824584-C8E6-57F7-A83C-564DA256F622"><p> <b>System servers:</b> these |
38 <li id="GUID-5B824584-C8E6-57F7-A83C-564DA256F622"><p> <b>System servers:</b> these |
39 file server, the window server etc. </p> </li> |
40 file server, the window server etc. </p> </li> |
40 <li id="GUID-9BE0FD09-B112-5AF6-A5D1-FBDD6A4EC00B"><p> <b>Local servers:</b> these |
41 <li id="GUID-9BE0FD09-B112-5AF6-A5D1-FBDD6A4EC00B"><p> <b>Local servers:</b> these |
41 are "local" to a process to provide multi-threaded access to thread-specific |
42 are "local" to a process to provide multi-threaded access to thread-specific |
42 resources, for example, the posix server (in the C Standard Library). </p> </li> |
43 resources, for example, the posix server (in the C Standard Library). </p> </li> |
43 </ul> </section> |
44 </ul> </section> |
44 <section id="GUID-EEA0A38B-F8A6-4308-A50D-B3E74B12420A"><title>Description</title> <p>The transient server supplied here |
45 <section id="GUID-EEA0A38B-F8A6-4308-A50D-B3E74B12420A"><title>Description</title> <p>The |
45 runs in a thread in its own process. This gives the server independence from |
46 transient server supplied here runs in a thread in its own process. This gives |
46 its clients. This is important because if the client were to create the server |
47 the server independence from its clients. This is important because if the |
47 as a separate thread within its own process, then the server would exit, i.e. |
48 client were to create the server as a separate thread within its own process, |
48 terminate, if its owning process terminated. This would be true even if clients |
49 then the server would exit, i.e. terminate, if its owning process terminated. |
49 in other processes were still connected to it. </p> <p>Equally as important: </p> <ul> |
50 This would be true even if clients in other processes were still connected |
|
51 to it. </p> <p>Equally as important: </p> <ul> |
50 <li id="GUID-432FCF7B-2393-5E59-BDE5-0A5B4BAFD155"><p>a client does not explicitly |
52 <li id="GUID-432FCF7B-2393-5E59-BDE5-0A5B4BAFD155"><p>a client does not explicitly |
51 need to start the server prior to connecting; this is done by the client interface. </p> </li> |
53 need to start the server prior to connecting; this is done by the client interface. </p> </li> |
52 <li id="GUID-D89C8F48-2CA2-5769-8DB9-42FD8FFA5879"><p>the server terminates |
54 <li id="GUID-D89C8F48-2CA2-5769-8DB9-42FD8FFA5879"><p>the server terminates |
53 when not in use shortly after the last client disconnects. </p> </li> |
55 when not in use shortly after the last client disconnects. </p> </li> |
54 <li id="GUID-968AB243-908B-5709-BB82-4213860CBC8A"><p>the code handles concurrency |
56 <li id="GUID-968AB243-908B-5709-BB82-4213860CBC8A"><p>the code handles concurrency |
152 <li><p><xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> - A Version 2 client/server class that |
154 <li><p><xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> - A Version 2 client/server class that |
153 clients use to package the arguments to be sent to a server.</p></li> |
155 clients use to package the arguments to be sent to a server.</p></li> |
154 <li><p><xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> - Indicates the completion status |
156 <li><p><xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> - Indicates the completion status |
155 of a request made to a service provider.</p></li> |
157 of a request made to a service provider.</p></li> |
156 </ul> </section> |
158 </ul> </section> |
157 <section id="GUID-86D3479E-216B-4D5D-AF57-C4C9963CD9F0"><title>Building and configuring</title> <p>To build the example: </p> <ul> |
159 <section id="GUID-86D3479E-216B-4D5D-AF57-C4C9963CD9F0"><title>Building and |
|
160 configuring</title> <p>To build the example: </p> <ul> |
158 <li id="GUID-FDC690A6-D68B-58E5-A10D-89220DB9B89E"><p>You can build the example |
161 <li id="GUID-FDC690A6-D68B-58E5-A10D-89220DB9B89E"><p>You can build the example |
159 from your IDE or the command line. </p> <p>If you use an IDE, import the <filepath>bld.inf</filepath> file |
162 from your IDE or the command line. </p> <p>If you use an IDE, import the <filepath>bld.inf</filepath> file |
160 of the example into your IDE, and use the build command of the IDE. </p> <p>If |
163 of the example into your IDE, and use the build command of the IDE. </p> <p>If |
161 you use the command line, open a command prompt, and set the current directory |
164 you use the command line, open a command prompt, and set the current directory |
162 to the source code directory of the example. You can then build the example |
165 to the source code directory of the example. You can then build the example |