|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-D0D27AEA-FDDB-5F6F-94F6-ADDF5910DC47" xml:lang="en"><title>Client/Server |
|
13 Overview</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-CA831E24-1BE6-4D18-889A-CD78364828C9"><title>Purpose</title> <p>Provides the Symbian platform client/server |
|
15 framework, by which a program can offer services to multiple other programs. |
|
16 Servers also handle resources on behalf of multiple clients.</p> <p>All Symbian |
|
17 platform developers should have a general understanding of this API in order |
|
18 to understand the design of many Symbian platform system APIs. In specialized |
|
19 circumstances, developers may also create their own server programs.</p> </section> |
|
20 <section id="GUID-539EF180-E0B7-4931-B1DC-BA7801D54F9F"><title>Architectural relationships</title> <p>Many important Symbian |
|
21 platform system APIs use the client/server framework to provide services to |
|
22 client programs: for example, the Windows Server, File Server, and Messaging. |
|
23 In some cases, such APIs provide extensive client-side classes that hide the |
|
24 direct use of the client/server interface from the client program.</p> </section> |
|
25 <section id="GUID-8163FC8D-F044-46D5-8806-13C8F22677A1"><title>Description</title> <p>The API has four key concepts: server |
|
26 (<codeph>CServer2</codeph>), session (<codeph>CSession2</codeph> and <codeph>RSessionBase</codeph>), |
|
27 sub-session (<codeph>RSubSessionBase</codeph>), and message (<codeph>RMessage2</codeph>, |
|
28 and <codeph>RMessagePtr2</codeph>). </p> <p><b>General |
|
29 properties</b> </p> <p>A server program offers services to other processes |
|
30 through a client interface API that it defines. Clients and servers use a |
|
31 message passing protocol to communicate.</p> <p>Client/server is usually chosen, |
|
32 rather than a conventional shared library, to provide services when one or |
|
33 more of the following is required:</p> <ul> |
|
34 <li id="GUID-7083F154-725B-5133-8391-41BBA67341E9"><p>management of shared |
|
35 system resource</p> </li> |
|
36 <li id="GUID-5C655C17-036C-50CD-BEE6-45C1A261FEC3"><p>asynchronous services</p> </li> |
|
37 <li id="GUID-AD3A0E0E-A4EB-5F50-8F9E-A906591839A6"><p>the protection offered |
|
38 by running in a separate process from clients.</p> </li> |
|
39 </ul> <p>A client/server implementation supplies a server program executable, |
|
40 and a <filepath>.DLL</filepath> containing the client-side interface.</p> <p><b>Server</b> </p> <p>The server is the central class of any server program. |
|
41 It is responsible for handling requests by clients to establish a connection |
|
42 to the server. </p> <p>The base server interface is provided by <xref href="GUID-8E316AC4-4676-301A-9A23-659E83AA1D1C.dita"><apiname>CServer2</apiname></xref>.</p> <p><b>Session</b> </p> <p>The session is the channel of communication between |
|
43 a client and a server. </p> <p>The base client-side session interface is provided |
|
44 by <xref href="GUID-6D8A458C-9A39-3000-A3BC-060A2A3663E6.dita"><apiname>RSessionBase</apiname></xref>. An implementation derives from this to |
|
45 define the functions that it wants to expose to clients.</p> <p>The corresponding |
|
46 server-side session base classes is <xref href="GUID-D5A30C75-E22C-34E8-913B-7D2CA6AD5C51.dita"><apiname>CSession2</apiname></xref>. A session |
|
47 can be shared between different client threads if the server marks the session |
|
48 as sharable. An implementation defines in a derived class how client messages |
|
49 should be handled.</p> <p><b>Sub-session</b> </p> <p>The sub-session presents an efficient refinement of a session where a |
|
50 client wants multiple simultaneous uses of a server. For example, with the |
|
51 File Server, each opened file is handled through a separate sub-session.</p> <p>The |
|
52 base client-side sub-session interface is provided by <xref href="GUID-1BBE1448-1DF8-33C4-BF9E-5A5F427AEE35.dita"><apiname>RSubSessionBase</apiname></xref>. |
|
53 An implementation derives from this to define the functions that it wants |
|
54 to expose to clients.</p> <p>A server implements a corresponding sub-session |
|
55 class based on <xref href="GUID-9230EF62-376A-389C-B720-7C1EDCB7EA97.dita"><apiname>CObject</apiname></xref>, <xref href="GUID-DE901A59-C714-356A-9490-C4E9C9F186DB.dita"><apiname>CObjectCon</apiname></xref> and <xref href="GUID-70824EE4-9E01-3AC0-9318-4B521A1FDD5E.dita"><apiname>CObjectIx</apiname></xref>, |
|
56 the Reference Counting Objects API.</p> <p><b>Message</b> </p> <p>The message is the information passed between client and server. |
|
57 It consists of a code that identifies the type of request that the client |
|
58 is making, and up to four 32-bit data arguments together with information |
|
59 about each argument's type, width and accessibility. It is also possible to |
|
60 pass just the code, with no arguments.</p> <p>Clients do not use messages |
|
61 directly; they use a <xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> object to package the message |
|
62 information that is to be sent to the server.</p> <p>Server-side sessions |
|
63 and subsessions access this information through an <xref href="GUID-D7D422D3-65E5-378B-8F52-6485BC5603A0.dita"><apiname>RMessage2</apiname></xref> object. </p> </section> |
|
64 <section id="GUID-74655E18-CC4C-4432-A8F3-BADFCA5CB7D2"><title>See also</title> <p><xref href="GUID-E189B0C0-AAB5-5472-996B-91043DE0B6D4.dita">Package |
|
65 Buffers Overview</xref> </p> <p><xref href="GUID-BE0C94BE-94F0-54B3-8674-366C09261E5D.dita">Reference |
|
66 Counting Objects Overview</xref> </p> <p><xref href="GUID-547CF71C-6A62-57C0-A9BE-E76B4286C6D6.dita">Threads |
|
67 And Processes Overview</xref> </p> </section> |
|
68 </conbody></concept> |