Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to connect to the service discovery database

To use the service discovery database, a client must:

  1. Create a session to the database object, RSdp, and open a connection.

  2. Create a subsession to the database object, RSdpDatabase, and open it. A client can have multiple subsessions open if required. (Sessions and subsessions are part of EPOC's architecture for interprocess communication: see Client/Server Overview).

  3. Close subsessions and sessions when they are no longer needed.

Example

The following example shows how to connect to the database:

// 1. Create and open session to the database
RSdp sdp;
User::LeaveIfError(sdp.Connect());

// 2. Create and open a subsession
RSdpDatabase sdpSubSession;
User::LeaveIfError(sdpSubSession.Open(sdp));

...
// 3. Cleanup
sdpSubSession.Close();
sdp.Close();

Notes

If all sessions to the SDP database are closed, then the database shuts down. Any application that offers a service should therefore keep a handle to the database as long as it is offering the service.