Server_App_Minimal: A Minimal Server Application Example

Download

Click on the following link to download the example: ServerApp.zip

Click: browse to view the example code.

Description

This example demonstrates a minimal server application making use of a minimal UI application.

The example application consists of three sub-projects:

  1. A harness project which uses the Client API to generate a client request and trigger the server application

  2. A service_support project consisting of Service Client Support and Service Implementation Support. Both client-side and server application-side support are built into a single DLL which encapsulates the IPC protocol between client and server.

  3. A server_application project that provides the entry point into the server application. This sub-project consists of the Server class and of the actual Application.

Service support classes

Service Client Support class (Client API)

Client side service support is provided through an REikAppServiceBase derived class, RServAppService. This class implements the following required functions:

Service Implementation Support class (Server Implementation API)

A CApaAppServiceBase derived class, CServAppSession, provides Service Implementation Support (support for the sessions connected to the server). The main purpose of this class is to override the pure virtual function CSession2::ServiceL(), such that a call to the appropriate service support code is made.

In this example, CServAppSession defines a pure virtual function, Display(), the functionality of which is implemented in the server application.

Server application classes

Server class

The server class CServAppServer is derived from CEikAppServer and implements the function CApaAppServer::CreateServiceL(). This function instantiates a session to handle the client request (by implementing an appropriate service).

Session class

CMinimalSession is a CApaAppServiceBase derived class that represents the session connected to the server. In order to handle the client request, this session class overrides the pure virtual function CServAppSession::Display(). Thus, the client request is implemented.

UI classes

Application class

Document class

Application UI class

View class

These four classes are almost the same as those in the minimal UI application example. A couple of slight modifications have been made:

  • CEikApplication::NewAppServerL() has been overridden in the Application class CExampleApplication to launch a new server application instance.

  • CExampleAppView::Draw() has been altered so that it produces an empty view.

Summary of class hierarchy of the classes used

Figure 1. Key Classes

Service Support

RApaAppServiceBase -> REikAppServiceBase -> RServAppService

CApaAppServiceBase -> CServAppSession

Server Application

CApaAppServer -> CEikAppServer -> CServAppServer

CServAppSession -> CMinimalSession

CApaApplication -> CEikApplication -> CExampleApplication

CEikDocument -> CExampleDocument

CEikAppUi -> CExampleAppUi

CCoeControl -> CExampleAppView