Provides the EPOC client/server framework, by which a program can offer services to multiple other programs. Servers also handle resources on behalf of multiple clients.
All EPOC developers should have a general understanding of this API in order to understand the design of many EPOC system APIs. In specialised circumstances, developers may also create their own server programs.
Many important EPOC system APIs use the client/server framework to provide services to client programs: for example, the Windows Server, File Server, Messaging, and ETel. In some cases, such APIs provide extensive client-side classes that hide the direct use of the client/server interface from the client program.
The API has four key concepts: server (CServer), session (CSharableSession, CSession and RSessionBase), sub-session (RSubSessionBase), and message (RMessage).
A server program offers services to other processes through a client interface API that it defines. Clients and servers use a message passing protocol to communicate.
Client/server is usually chosen, rather than a conventional shared library, to provide services when one or more of the following is required: management of shared system resources; asynchronous services; protection offered by running in a separate process from clients.
A client/server implementation supplies a server program
executable, and a .DLL
containing the client-side
interface.
The server is the central class of any server program. It is responsible for handling requests by clients to establish a connection to the server.
The base server interface is provided by
CServer
.
The session is the channel of communication between a client and a server.
The base client-side session interface is provided by
RSessionBase
. An implementation derives from this to
define the functions that it wants to expose to clients.
The corresponding server-side session base classes are
CSession
, and CSharableSession
, which
allows a session to be shared between different client threads. An
implementation defines in a derived class how client messages should be
handled.
The sub-session presents a efficient refinement of a session when a client wants multiple simultaneous uses of a server. For example, with the File Server, each opened file is handled through a separate sub-session.
The base client-side sub-session interface is provided by
RSubSessionBase
. An implementation derives from this to
define the functions that it wants to expose to clients.
A server implements a corresponding sub-session class based on
CObject
from the Reference Counting Objects API.
The message is the data structure passed between client and server. It contains an code specifying the type of client request, and four 32-bit data parameters. Clients do not use messages directly as they are encapsulated in client-side session and sub-session interfaces. Server-side sessions and sub-sessions read client data from messages, and write data back to them to be returned to the client.
The message interface is provided by
RMessage
.