03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Symbian OS machine arrives. Also, when a client's receive request is fulfilled, it doesn't<br />

issue a new one until it has handled the previous one, which causes a transient<br />

condition whereby the client is unable to receive.<br />

GSDP specifies no formal mechanism for releasing a GSDP port ID, which means it's<br />

important that port IDs be allocated uniquely by a given GSDP server. The Symbian OS<br />

GSDP server maintains the last-allocated port ID in a file in c:\System\Data\: the port ID is<br />

incremented and restored every time a new session is initiated or accepted. This file persists<br />

across GSDP server invocations and guarantees unique port ID allocation provided that all<br />

port IDs are dropped by the time wraparound occurs. In practice, this is sufficient: if one port<br />

ID was allocated per second, it would take over 143 years to wraparound.<br />

Symbian OS Implementation – Client-side<br />

On Symbian OS, the GSDP client API is defined in gsdp.h and delivered in gsdp.dll. The<br />

client API consists of two classes: a concrete RGsdpSession class to control the session<br />

and send packets, and an abstract MGsdpPacketHandler class that you should implement<br />

for handling received packets (see Figure A3.4).<br />

Figure A3.4<br />

Additionally, a private, client-side active object, CGsdpReceiveHandler, turns the client<br />

listen function into a continuously renewed receive request. This removes any responsibility<br />

from the client to implement its own active object to handle or renew the request.<br />

Here's RGsdpSession's declaration in C++, showing additional housekeeping and getter<br />

functions:<br />

class RGsdpSession : public RSessionBase<br />

{<br />

public:<br />

// construct

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

Saved successfully!

Ooh no, something went wrong!