SlideShare una empresa de Scribd logo
1 de 34
Symbian OS Client-Server Framework v2.0a – 29 April 2008 1 Andreas Jakl, 2008
Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria ( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006.  Andreas Jakl, 2008 2
Contents Client-Server Framework Architecture Message Passing Servers and Sessions Andreas Jakl, 2008 3 Colour coding used in these slides: Client Server Kernel
Client-Server Framework Theory of the … Andreas Jakl, 2008 4
Client-Server Pattern Client makes use of services provided by a server Server: Receives request messages from its clients Handles requests (synchronously or asynchronously) Andreas Jakl, 2008 5 Client Server Messages
Client-Server Architecture Most of the system services in Symbian OS are client-server-based Examples: Window Server (UI, keypad) File Server Socket Server Telephony Server Andreas Jakl, 2008 6
Advantages: Plugins Extensibility: Plug-in modules for globally available new object types (e.g. new multimedia codecs, …) Andreas Jakl, 2008 7 File Server Local file system Flash filing system Sockets Server Infrared protocols TCP/IP SMS
Advantages Efficiency Multiple clients use a single server Security Server/Client in different threads (usually also different processes). Communication through messages client can not “crash” server Asynchronous Server uses Active Objects for return messages. No polling needed  good for our battery! Andreas Jakl, 2008 8
Structure – Example Andreas Jakl, 2008 9 myApp.exe Client Links efsrv.lib, uses API-methods like:RFs::Connect() Client-sideFile Server implementation efsrv.dll Client-Servercommunication (via Kernel) Process Boundary efile.exe File Server
R-type Classes For client-side implementation R: Owns external Resource handle (e.g. handle to a server session) Resource allocation: usually Open(), Create() or Initialize() Deallocation: usually Close() or Reset() The destructor doesn’t do it – most of the times, there is no destructor App. should release the resource as soon as possible Can be instantiated on the stack (automatic variable) or on the heap (instance variable) Andreas Jakl, 2008 10
Examplecode Andreas Jakl, 2008 11 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs);		// file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
Session Session = Communication channel between client and server Initiated by a client Kernel creates server-side representation Messages between client / server mediated by kernel Only onesynchronous request may be submitted at a time ... but multipleasynchronous requests may be outstanding Andreas Jakl, 2008 12
Client-side Representation Server is usually accessible through a public client class Handles details of establishing a session with its server Sends commands to the server Handles receiving responses Derives from RSessionBase  Hides implementation details of the private client-server communication protocol Example: Simple functions RFs::Delete() or RFs::GetDir() communicate with the file server and hide the more complex client-server communication protocol Andreas Jakl, 2008 13
Communication Andreas Jakl, 2008 14 Calls functions from the base class Establishsession Own, privateprotocol Disconnect
Communication Send data between processes: Message Passing: Used in all cases Inter-process communication (IPC): For large data packets, if needed Andreas Jakl, 2008 15 Kernel Client Server Process Boundary
Messages [1] Clients send messages to servers Each message is a request for a service Server processes request Performs work on behalf of the client Optionally sends a reply to the client Messages can be sent: synchronously, or asynchronously Andreas Jakl, 2008 16
Messages [2] Request message: Consists of five 32-bit numbers Function number Four 32-bit parameters Each of the four parameters can be: An integer (TInt) A pointer to a flat data structure, wrapped as a Symbian OS descriptor ( read using IPC) Andreas Jakl, 2008 17
MessagePassing Andreas Jakl, 2008 18 Server Client four 32-bit parameters x=RXxxSession::Foo(a,b,c) foo a b c - ServiceL(RMessage2 aMessage) Server processes the request... aMessage.Complete(x) x
Inter-ProcessCommunication Andreas Jakl, 2008 19 Server Client y=RXxxSession::Bar(a,b,c) bar p &q &r - ServiceL(RMessage1 aMessage) q aMessage.ReadL() r aMessage.WriteL() aMessage.Complete(y) y
Request-Handling Andreas Jakl, 2008 20 “2” – Symbian OS 9: Capability-Support Client Server RSessionBaseSendReceive() Functions for the client, converts requests to parameters CSession2ServiceL() Handling of requests, represents session server-side CServer2 (Active Obj)RunL() Receives requests, forward to corresponding session RMessage2Complete() For client/server data transfer DSessionLinks Client/Server, Cleanup Kernel
Server Lifetime Three options: System Server: Started with the mobile phone, essential for the OS (e.g. File Server, Window Server). Unexpected termination usually forces phone reboot. Application / Transient Server: Started on request of an application, closed when last client disconnects.If a second client starts a new server, no error is produced, existing server instance is used. Other Servers: Started and closed with an individual application. If used by multiple applications: each app. has its own private instance; e.g. POSIX server. Andreas Jakl, 2008 21
Server Lifetime Andreas Jakl, 2008 22 System System server connect disconnect Application 1 connect disconnect App. server connect disconnect Application 2 Other server
Processes & Servers 23 Same-processservers Privilegedcode Fixedprocesses ekern.exe(privileged)Kernelserver efsrv.exe(fixed)File server ewsrv.exe(fixed)Windowserver fbsrv.exe(fixed)Font & bitmapserver c32exe.exe(fixed)Comms, Sockets, Telephonyservers app1.exe Application xxx.exe…server edbsrv.exeDBMS server app2.exe Application app3.exe Application Private server Ordinaryapplications Ordinaryservers Private server Andreas Jakl, 2008
Sessions Andreas Jakl, 2008 24 Server thread Server can serve multiple clients A client can have multiple sessions with a server Each session requires resources  Server CServer2 Server side session CSession2 Server side session CSession2 Server side session CSession2 Client side session RSessionBase Client side session RSessionBase Client side session RSessionBase Client 1 (thread) Client 2 (thread)
Subsessions Solution: SubSessions e.g. File Server: One Session per Client (RFs), multiple files represent SubSessions (RFile)  no new session for every single file! Andreas Jakl, 2008 25 Server thread Server CServer2 Server side session CSession2 Client side session RSessionBase Subsession RSubSessionBase Subsession RSubSessionBase Client (thread)
API Example Andreas Jakl, 2008 26 class RFs : public RSessionBase {...} class RFsBase : public RSubSessionBase {...} class RFile : public RFsBase { public: IMPORT_C TInt Open(RFs& aFs, const TDesC& aName, TUintaFileMode); IMPORT_C TInt Read(TDes8& aDes) const; IMPORT_C void Read(TDes8& aDes, TRequestStatus& aStatus) const; IMPORT_C TInt Write(const TDesC8& aDes); IMPORT_C void Write(const TDesC8& aDes, TRequestStatus& aStatus); [...] };
Examplecode (Revisited) Andreas Jakl, 2008 27 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs);		// file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
Performance Communication: Overhead through thread / process context switches Inter-process data transfer requires mapping client data area to server’s virtual address space Best practice: Transfer a large amount of data in a single transaction instead of performing a number of server accesses Example: Most Symbian OS components don’t use RFile::Read() / Write() directly, but instead use buffered streams (RReadStream() / RWriteStream()) Andreas Jakl, 2008 28
Is a Server Required? Need to share functionality or resources across a number of threads or processes? Require isolation between service provider and service user? Pre-emptive asynchronous processing desirable? Gains outweigh costs? Andreas Jakl, 2008 29
ASD-like Question – Easy  Which of the following statements correctly describe the client-server model in Symbian OS? A. A client and server always execute in separate threads. B. A client and server always execute in separate processes. C. A client initiates a server request by passing an integer to identify the request. It then sends any “payload” data separately. D. To return data to a client, the server writes directly into the client’s address space. E. At any time, there can only be one outstanding synchronous client request to a server. Andreas Jakl, 2008 30 Copyright Meme Education, 2006 http://www.meme-education.com/
Solution A.	Correct.  B.	Incorrect. Most servers are executed in an own process, but it is not required.  C.Incorrect. The data is sent together with the function request as a parameter. D.	Incorrect. The return values are sent using a message object. E.	Correct.  Andreas Jakl, 2008 31
ASD-like Question – Medium For which of the following scenarios would a developer choose to implement a client and server on Symbian OS? A. To provide utility code, such as a 3D graphics library. B. To implement a system-wide “broadcast” notification system. C. To manage access to a hardware resource, such as the camera. D. To implement a Bluetooth game where the host player runs as a server and all other players are clients. E. To implement a user interface application for displaying weather information. Andreas Jakl, 2008 32 Copyright Meme Education, 2006 http://www.meme-education.com/
Solution A.	Incorrect. The performance overhead would be too high.  B.	Correct.  C.Correct. D.	Incorrect. This has nothing to do with the client/server communication within Symbian OS. E.	Incorrect. UI and application logic should be separated, but rather by using DLLs instead of implementing client/server communication. Andreas Jakl, 2008 33
Thanks for your attention That’s it! Andreas Jakl, 2008 34

Más contenido relacionado

La actualidad más candente

XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...The Linux Foundation
 
Scale 12x Securing Your Cloud with The Xen Hypervisor
Scale 12x Securing Your Cloud with The Xen HypervisorScale 12x Securing Your Cloud with The Xen Hypervisor
Scale 12x Securing Your Cloud with The Xen HypervisorThe Linux Foundation
 
XPDS16: Xen Project Weather Report 2016
XPDS16: Xen Project Weather Report 2016XPDS16: Xen Project Weather Report 2016
XPDS16: Xen Project Weather Report 2016The Linux Foundation
 
Distributed computing environment
Distributed computing environmentDistributed computing environment
Distributed computing environmentRavi Bhushan
 
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal HarouniBSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal HarouniShellmates
 
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...The Linux Foundation
 
From L3 to seL4: What have we learnt in 20 years of L4 microkernels
From L3 to seL4: What have we learnt in 20 years of L4 microkernelsFrom L3 to seL4: What have we learnt in 20 years of L4 microkernels
From L3 to seL4: What have we learnt in 20 years of L4 microkernelsmicrokerneldude
 
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...Heavybit
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming ReportShivek Khurana
 
12th Japan CloudStack User Group Meetup MidoNet with scalable virtual router
12th Japan CloudStack User Group Meetup   MidoNet with scalable virtual router12th Japan CloudStack User Group Meetup   MidoNet with scalable virtual router
12th Japan CloudStack User Group Meetup MidoNet with scalable virtual routerTakeshi Nakajima
 
Detecting virtual machine co residency in cloud computing with active traffic...
Detecting virtual machine co residency in cloud computing with active traffic...Detecting virtual machine co residency in cloud computing with active traffic...
Detecting virtual machine co residency in cloud computing with active traffic...James A. Savage
 

La actualidad más candente (17)

Microkernel design
Microkernel designMicrokernel design
Microkernel design
 
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
 
Scale 12x Securing Your Cloud with The Xen Hypervisor
Scale 12x Securing Your Cloud with The Xen HypervisorScale 12x Securing Your Cloud with The Xen Hypervisor
Scale 12x Securing Your Cloud with The Xen Hypervisor
 
A Xen Case Study
A Xen Case StudyA Xen Case Study
A Xen Case Study
 
XPDS16: Xen Project Weather Report 2016
XPDS16: Xen Project Weather Report 2016XPDS16: Xen Project Weather Report 2016
XPDS16: Xen Project Weather Report 2016
 
CT
CTCT
CT
 
Distributed computing environment
Distributed computing environmentDistributed computing environment
Distributed computing environment
 
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal HarouniBSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
 
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
 
From L3 to seL4: What have we learnt in 20 years of L4 microkernels
From L3 to seL4: What have we learnt in 20 years of L4 microkernelsFrom L3 to seL4: What have we learnt in 20 years of L4 microkernels
From L3 to seL4: What have we learnt in 20 years of L4 microkernels
 
Lab1
Lab1Lab1
Lab1
 
Microkernel
MicrokernelMicrokernel
Microkernel
 
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
 
Chapter16 new
Chapter16 newChapter16 new
Chapter16 new
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming Report
 
12th Japan CloudStack User Group Meetup MidoNet with scalable virtual router
12th Japan CloudStack User Group Meetup   MidoNet with scalable virtual router12th Japan CloudStack User Group Meetup   MidoNet with scalable virtual router
12th Japan CloudStack User Group Meetup MidoNet with scalable virtual router
 
Detecting virtual machine co residency in cloud computing with active traffic...
Detecting virtual machine co residency in cloud computing with active traffic...Detecting virtual machine co residency in cloud computing with active traffic...
Detecting virtual machine co residency in cloud computing with active traffic...
 

Similar a Symbian OS Client-Server Framework

Symbian OS - Platform Security
Symbian OS - Platform SecuritySymbian OS - Platform Security
Symbian OS - Platform SecurityAndreas Jakl
 
Symbian OS - Communication And Messaging
Symbian OS - Communication And MessagingSymbian OS - Communication And Messaging
Symbian OS - Communication And MessagingAndreas Jakl
 
Java ME - 01 - Overview
Java ME - 01 - OverviewJava ME - 01 - Overview
Java ME - 01 - OverviewAndreas Jakl
 
Introduction To AMF
Introduction To AMFIntroduction To AMF
Introduction To AMFtomhensel
 
Symbian OS - Quick Start
Symbian OS - Quick StartSymbian OS - Quick Start
Symbian OS - Quick StartAndreas Jakl
 
Windows Server 2008 R2 Dev Session 01
Windows Server 2008 R2 Dev Session 01Windows Server 2008 R2 Dev Session 01
Windows Server 2008 R2 Dev Session 01Clint Edmonson
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overviewtamilmani1020
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overviewmagicshui
 
Symbian Os Introduction
Symbian Os IntroductionSymbian Os Introduction
Symbian Os IntroductionDeepak Rathi
 
WIndows Embedded Compact 2013 – What’s news
WIndows Embedded Compact 2013 – What’s newsWIndows Embedded Compact 2013 – What’s news
WIndows Embedded Compact 2013 – What’s newsMirco Vanini
 
Symbian OS - Multimedia Framework
Symbian OS - Multimedia FrameworkSymbian OS - Multimedia Framework
Symbian OS - Multimedia FrameworkAndreas Jakl
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworksnawal saad
 
1 Win7 For Devs Fund Search
1 Win7 For Devs Fund Search1 Win7 For Devs Fund Search
1 Win7 For Devs Fund Searchllangit
 
Tcp performance Final Report
Tcp performance Final Report Tcp performance Final Report
Tcp performance Final Report ambitlick
 

Similar a Symbian OS Client-Server Framework (20)

Symbian OS - Platform Security
Symbian OS - Platform SecuritySymbian OS - Platform Security
Symbian OS - Platform Security
 
Symbian OS - Communication And Messaging
Symbian OS - Communication And MessagingSymbian OS - Communication And Messaging
Symbian OS - Communication And Messaging
 
Java ME - 01 - Overview
Java ME - 01 - OverviewJava ME - 01 - Overview
Java ME - 01 - Overview
 
Introduction To AMF
Introduction To AMFIntroduction To AMF
Introduction To AMF
 
Dot net Introduction and their usabilities
Dot net Introduction and  their usabilitiesDot net Introduction and  their usabilities
Dot net Introduction and their usabilities
 
Symbian OS - Quick Start
Symbian OS - Quick StartSymbian OS - Quick Start
Symbian OS - Quick Start
 
Mina2
Mina2Mina2
Mina2
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
Windows Server 2008 R2 Dev Session 01
Windows Server 2008 R2 Dev Session 01Windows Server 2008 R2 Dev Session 01
Windows Server 2008 R2 Dev Session 01
 
Usenix Invited Talk
Usenix Invited TalkUsenix Invited Talk
Usenix Invited Talk
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overview
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overview
 
Symbian Os Introduction
Symbian Os IntroductionSymbian Os Introduction
Symbian Os Introduction
 
As Pdotnet
As PdotnetAs Pdotnet
As Pdotnet
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
WIndows Embedded Compact 2013 – What’s news
WIndows Embedded Compact 2013 – What’s newsWIndows Embedded Compact 2013 – What’s news
WIndows Embedded Compact 2013 – What’s news
 
Symbian OS - Multimedia Framework
Symbian OS - Multimedia FrameworkSymbian OS - Multimedia Framework
Symbian OS - Multimedia Framework
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworks
 
1 Win7 For Devs Fund Search
1 Win7 For Devs Fund Search1 Win7 For Devs Fund Search
1 Win7 For Devs Fund Search
 
Tcp performance Final Report
Tcp performance Final Report Tcp performance Final Report
Tcp performance Final Report
 

Más de Andreas Jakl

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityAndreas Jakl
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAndreas Jakl
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndreas Jakl
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndreas Jakl
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndreas Jakl
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Andreas Jakl
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web TechnologiesAndreas Jakl
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreAndreas Jakl
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Andreas Jakl
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test AutomationAndreas Jakl
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Andreas Jakl
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneAndreas Jakl
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingAndreas Jakl
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartAndreas Jakl
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosAndreas Jakl
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentAndreas Jakl
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)Andreas Jakl
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt CommunicationAndreas Jakl
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and GraphicsAndreas Jakl
 

Más de Andreas Jakl (20)

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented Reality
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with Unity
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App Management
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSON
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - Introduction
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web Technologies
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test Automation
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer Training
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC Quickstart
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App Scenarios
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC Development
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt Communication
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
 

Último

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Último (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

Symbian OS Client-Server Framework

  • 1. Symbian OS Client-Server Framework v2.0a – 29 April 2008 1 Andreas Jakl, 2008
  • 2. Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria ( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006. Andreas Jakl, 2008 2
  • 3. Contents Client-Server Framework Architecture Message Passing Servers and Sessions Andreas Jakl, 2008 3 Colour coding used in these slides: Client Server Kernel
  • 4. Client-Server Framework Theory of the … Andreas Jakl, 2008 4
  • 5. Client-Server Pattern Client makes use of services provided by a server Server: Receives request messages from its clients Handles requests (synchronously or asynchronously) Andreas Jakl, 2008 5 Client Server Messages
  • 6. Client-Server Architecture Most of the system services in Symbian OS are client-server-based Examples: Window Server (UI, keypad) File Server Socket Server Telephony Server Andreas Jakl, 2008 6
  • 7. Advantages: Plugins Extensibility: Plug-in modules for globally available new object types (e.g. new multimedia codecs, …) Andreas Jakl, 2008 7 File Server Local file system Flash filing system Sockets Server Infrared protocols TCP/IP SMS
  • 8. Advantages Efficiency Multiple clients use a single server Security Server/Client in different threads (usually also different processes). Communication through messages client can not “crash” server Asynchronous Server uses Active Objects for return messages. No polling needed  good for our battery! Andreas Jakl, 2008 8
  • 9. Structure – Example Andreas Jakl, 2008 9 myApp.exe Client Links efsrv.lib, uses API-methods like:RFs::Connect() Client-sideFile Server implementation efsrv.dll Client-Servercommunication (via Kernel) Process Boundary efile.exe File Server
  • 10. R-type Classes For client-side implementation R: Owns external Resource handle (e.g. handle to a server session) Resource allocation: usually Open(), Create() or Initialize() Deallocation: usually Close() or Reset() The destructor doesn’t do it – most of the times, there is no destructor App. should release the resource as soon as possible Can be instantiated on the stack (automatic variable) or on the heap (instance variable) Andreas Jakl, 2008 10
  • 11. Examplecode Andreas Jakl, 2008 11 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs); // file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
  • 12. Session Session = Communication channel between client and server Initiated by a client Kernel creates server-side representation Messages between client / server mediated by kernel Only onesynchronous request may be submitted at a time ... but multipleasynchronous requests may be outstanding Andreas Jakl, 2008 12
  • 13. Client-side Representation Server is usually accessible through a public client class Handles details of establishing a session with its server Sends commands to the server Handles receiving responses Derives from RSessionBase  Hides implementation details of the private client-server communication protocol Example: Simple functions RFs::Delete() or RFs::GetDir() communicate with the file server and hide the more complex client-server communication protocol Andreas Jakl, 2008 13
  • 14. Communication Andreas Jakl, 2008 14 Calls functions from the base class Establishsession Own, privateprotocol Disconnect
  • 15. Communication Send data between processes: Message Passing: Used in all cases Inter-process communication (IPC): For large data packets, if needed Andreas Jakl, 2008 15 Kernel Client Server Process Boundary
  • 16. Messages [1] Clients send messages to servers Each message is a request for a service Server processes request Performs work on behalf of the client Optionally sends a reply to the client Messages can be sent: synchronously, or asynchronously Andreas Jakl, 2008 16
  • 17. Messages [2] Request message: Consists of five 32-bit numbers Function number Four 32-bit parameters Each of the four parameters can be: An integer (TInt) A pointer to a flat data structure, wrapped as a Symbian OS descriptor ( read using IPC) Andreas Jakl, 2008 17
  • 18. MessagePassing Andreas Jakl, 2008 18 Server Client four 32-bit parameters x=RXxxSession::Foo(a,b,c) foo a b c - ServiceL(RMessage2 aMessage) Server processes the request... aMessage.Complete(x) x
  • 19. Inter-ProcessCommunication Andreas Jakl, 2008 19 Server Client y=RXxxSession::Bar(a,b,c) bar p &q &r - ServiceL(RMessage1 aMessage) q aMessage.ReadL() r aMessage.WriteL() aMessage.Complete(y) y
  • 20. Request-Handling Andreas Jakl, 2008 20 “2” – Symbian OS 9: Capability-Support Client Server RSessionBaseSendReceive() Functions for the client, converts requests to parameters CSession2ServiceL() Handling of requests, represents session server-side CServer2 (Active Obj)RunL() Receives requests, forward to corresponding session RMessage2Complete() For client/server data transfer DSessionLinks Client/Server, Cleanup Kernel
  • 21. Server Lifetime Three options: System Server: Started with the mobile phone, essential for the OS (e.g. File Server, Window Server). Unexpected termination usually forces phone reboot. Application / Transient Server: Started on request of an application, closed when last client disconnects.If a second client starts a new server, no error is produced, existing server instance is used. Other Servers: Started and closed with an individual application. If used by multiple applications: each app. has its own private instance; e.g. POSIX server. Andreas Jakl, 2008 21
  • 22. Server Lifetime Andreas Jakl, 2008 22 System System server connect disconnect Application 1 connect disconnect App. server connect disconnect Application 2 Other server
  • 23. Processes & Servers 23 Same-processservers Privilegedcode Fixedprocesses ekern.exe(privileged)Kernelserver efsrv.exe(fixed)File server ewsrv.exe(fixed)Windowserver fbsrv.exe(fixed)Font & bitmapserver c32exe.exe(fixed)Comms, Sockets, Telephonyservers app1.exe Application xxx.exe…server edbsrv.exeDBMS server app2.exe Application app3.exe Application Private server Ordinaryapplications Ordinaryservers Private server Andreas Jakl, 2008
  • 24. Sessions Andreas Jakl, 2008 24 Server thread Server can serve multiple clients A client can have multiple sessions with a server Each session requires resources Server CServer2 Server side session CSession2 Server side session CSession2 Server side session CSession2 Client side session RSessionBase Client side session RSessionBase Client side session RSessionBase Client 1 (thread) Client 2 (thread)
  • 25. Subsessions Solution: SubSessions e.g. File Server: One Session per Client (RFs), multiple files represent SubSessions (RFile)  no new session for every single file! Andreas Jakl, 2008 25 Server thread Server CServer2 Server side session CSession2 Client side session RSessionBase Subsession RSubSessionBase Subsession RSubSessionBase Client (thread)
  • 26. API Example Andreas Jakl, 2008 26 class RFs : public RSessionBase {...} class RFsBase : public RSubSessionBase {...} class RFile : public RFsBase { public: IMPORT_C TInt Open(RFs& aFs, const TDesC& aName, TUintaFileMode); IMPORT_C TInt Read(TDes8& aDes) const; IMPORT_C void Read(TDes8& aDes, TRequestStatus& aStatus) const; IMPORT_C TInt Write(const TDesC8& aDes); IMPORT_C void Write(const TDesC8& aDes, TRequestStatus& aStatus); [...] };
  • 27. Examplecode (Revisited) Andreas Jakl, 2008 27 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs); // file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
  • 28. Performance Communication: Overhead through thread / process context switches Inter-process data transfer requires mapping client data area to server’s virtual address space Best practice: Transfer a large amount of data in a single transaction instead of performing a number of server accesses Example: Most Symbian OS components don’t use RFile::Read() / Write() directly, but instead use buffered streams (RReadStream() / RWriteStream()) Andreas Jakl, 2008 28
  • 29. Is a Server Required? Need to share functionality or resources across a number of threads or processes? Require isolation between service provider and service user? Pre-emptive asynchronous processing desirable? Gains outweigh costs? Andreas Jakl, 2008 29
  • 30. ASD-like Question – Easy Which of the following statements correctly describe the client-server model in Symbian OS? A. A client and server always execute in separate threads. B. A client and server always execute in separate processes. C. A client initiates a server request by passing an integer to identify the request. It then sends any “payload” data separately. D. To return data to a client, the server writes directly into the client’s address space. E. At any time, there can only be one outstanding synchronous client request to a server. Andreas Jakl, 2008 30 Copyright Meme Education, 2006 http://www.meme-education.com/
  • 31. Solution A. Correct. B. Incorrect. Most servers are executed in an own process, but it is not required. C.Incorrect. The data is sent together with the function request as a parameter. D. Incorrect. The return values are sent using a message object. E. Correct. Andreas Jakl, 2008 31
  • 32. ASD-like Question – Medium For which of the following scenarios would a developer choose to implement a client and server on Symbian OS? A. To provide utility code, such as a 3D graphics library. B. To implement a system-wide “broadcast” notification system. C. To manage access to a hardware resource, such as the camera. D. To implement a Bluetooth game where the host player runs as a server and all other players are clients. E. To implement a user interface application for displaying weather information. Andreas Jakl, 2008 32 Copyright Meme Education, 2006 http://www.meme-education.com/
  • 33. Solution A. Incorrect. The performance overhead would be too high. B. Correct. C.Correct. D. Incorrect. This has nothing to do with the client/server communication within Symbian OS. E. Incorrect. UI and application logic should be separated, but rather by using DLLs instead of implementing client/server communication. Andreas Jakl, 2008 33
  • 34. Thanks for your attention That’s it! Andreas Jakl, 2008 34