Using a Service by the Client

Procedure

A client must perform the following steps to use a service implemented over the server application framework:

  1. Identify the service support provided for the service in the platform.

  2. Include the client-support header of the service support and link to the service support DLL.

  3. Use the service's implementation discovery support to find an implementation to connect to.

  4. Create a new instance of the client-side service, connecting it to a new or existing service application instance as necessary.

  5. Monitor the lifetime of the server application, so that appropriate cleanup can be performed on server application exit.

  6. Use the server application.

Using a chat service example

The following is an example of a chat service.

void CMyApp::HandleCommandL(aCommand)
…
    case EMyAppCmdStart:
        iChatter = new(ELeave) CChatter(this);
        iChatter->ConstructL(TUid::Uid(0x0de630f1));
        iServerMonitor = CApaServerAppExitMonitor::NewL(iChatter->iSub, this);
    break; 

    case EMyAppCmdSend:
        if (iChatter)
            iChatter->SendL(_L("hello server"));
    break;
Related concepts
Server Applications