03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

equest: that means at most one RMessage for a request being handled synchronously from<br />

one client, and any number of RMessages for requests being handled asynchronously.<br />

CServer – a server<br />

CServer is the active object that fields messages from all potential clients and channels<br />

them to the right CSession/CSharableSession object to be interpreted and executed.<br />

Here are the relevant parts of the CServer declaration:<br />

class CServer : public CActive<br />

{<br />

protected:<br />

enum TserverType {EUnsharableSessions,ESharableSessions};<br />

...<br />

public:<br />

IMPORT_C ~CServer() =0;<br />

IMPORT_C TInt Start(const TDesC& aName);<br />

IMPORT_C void StartL(const TDesC& aName);<br />

IMPORT_C void ReStart();<br />

inline const RMessage& Message() const;<br />

protected:<br />

IMPORT CServer(Tint aPriority,TServerType<br />

aType=EUnsharableSessions);<br />

IMPORT_C void DoCancel();<br />

IMPORT_C void RunL();<br />

private:<br />

virtual CSharableSession* NewSessionL(const TVersion& aVersion)<br />

...<br />

protected:<br />

const = 0;<br />

TSessionControl iControl;<br />

HBufC* iName;<br />

private:<br />

const TServerType iSessionType;<br />

RServer iServer;<br />

TDblQue iSessionQ;<br />

protected:<br />

TDblQueIter iSessionIter;<br />

};<br />

The server is-a active object. It issues a request to the kernel for a message from any client.<br />

Its RunL() function (which should really be private) then handles the message, usually by<br />

finding the appropriate session and calling its ServiceL() function.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!