Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


AdvancedClientServerExample: Using Client/Server APIs

[Top]


Introduction

This example application demonstrates the use of client/server APIs using a logical device driver (LDD) and a physical device driver (PDD). Unlike the other client/server examples under the examples\Base\IPC\ClientServer folder, this example implements asynchronous as well as synchronous client requests to the server. This example also demonstrates a client and server running in separate processes and a client and server running in the same process.

This example demonstrates the following:

This example is located in the examples\Base\IPC\AdvancedClientServerExample folder. It consists of several folders, described below.

[Top]


Directories


common

This directory contains code that is common to the process and thread servers. It implements the shut down server which checks the number of connected clients to the thread or process server. If this number is zero, then after a time delay, the thread/process server is terminated. The server is not terminated in the following cases:


driver

Device drivers are DLLs that allow code to communicate with hardware. For more information about device drivers, see the Device driver tutorial.


ProcessClient

This directory implements a client DLL that starts the process server and creates a session with it. The client DLL provides an API to allow clients to request the server to load and unload the device driver.


ProcessServer

This directory implements the process server class CProcessServer, which is derived from CServer2. It handles client requests to interact with the device drivers. It can have multiple clients connected at the same time. The device driver, server and client all have the MultimediaDD capability. Note that this is for demonstration purposes rather than because the code uses any Multimedia APIs. The session class CProcessServerSession implements a simple message queue to hold asynchronous requests.


ThreadClient

This directory implements a client DLL that starts the thread server and creates a session within it. The client DLL provides an API to allow clients to request the server to load and unload the device driver.


ThreadServer

This directory implements the thread server class CThreadServer, which is derived from CServer2. An instance of the thread server runs in the same process as the client. The thread server handles client requests to interact with the device drivers. It can have multiple clients connected at the same time. The session class CThreadServerSession implements a simple message queue to hold asynchronous requests.


test

This example directory contains a comprehensive test suite to test the process client and server and the thread client and server.

[Top]


Class Summary

The following classes are used in this example application:

[Top]


Build

Build the development and test code using the abld build command from AdvancedClientServerExample\group as described in the Symbian OS build process.

The AdvancedClientServerExample builds the following binaries in the standard location (\epoc32\release\winscw\<build_variant> for CodeWarrior):

After launching the Te_ProcessClientServerTestSuite.exe or Te_ThreadClientServerTestSuite.exe executable, depending on the emulator you are using, you may have to navigate away from the application launcher/shell screen to view the console.

[Top]


Running tests

To run the tests, perform the following steps:

  1. From the command prompt, change directory to epoc32\release\winscw\udeb.

  2. Run the following command:

    > epoc

  3. On the emulator, go to eshell.

  4. Run the following commands:

    > testexecute c:\testdata\scripts\te_processclientservertestsuite.script

    > testexecute c:\testdata\scripts\te_threadclientservertestsuite.script

    Note: Test results are stored in the epoc32\winscw\c\logs\testexecute directory:

    • Process server tests: Refer to the te_processclientservertestsuite.htm file.

    • Thread server tests: Refer to the te_threadclientservertestsuite.htm file.

[Top]


See also