I am designing a server client architecture in Symbian platform and it seems to get overly complicated.
Basically I have 1. my application 2. Third party application and 3. agenda database, looks like I also need 4. agenda observer and 5. message relay server
And all should work seamlesly together, both in S60 and S80.
This is the way I am thinking about doing it:
The application (1) will start a CServer object (5) which will relay messages, and it will give it a callback reference. Can normal class pointers can be passed through CSession interfaces?
The application will register an agenda observer (4), which will in StartObserving function open a session into the server (5) too and pass a callback pointer to the CServer object.
The third party application (2) will open a session into CServer object (5) and pass a callback object into it.
Now when an event comes to agenda observer (4) from agenda DB (3), it invokes FooEvent in the server session (5), and the server will call all callback pointers it has to relay the message.
Any way of reducing the number of different executables? Can agenda observer (4) and 'message distributor' (5) be combined into single dll? Is it possible to pass pointers between different executables through dll interfaces? What kind of thread safeguards should I use for communication between processes?
you can not use pointer too often between clients and servers, unless you always run all of the different modules in same process. Anyway, I would suggest using normal client/server message passing, unless the data size transfered is huge.
Basically you need to start the client server connection from clients always, but you could have your server sending UserEvents to the clients to notify them on a event, so they would know to make the connection.
Anyway, in case you are doing OS 7.0s you could have look into the paper in symbian site of new communications methods. Basically the publiser-subciper that is supported by OS 8.0, but is backported to OS 7.0s phones (except 6600), it might give you better possibilitie on your architectural desings.
So what happens is that the pointer is passed, but the other process gets an access violation if it tries to use the pointer?
File server RFs has has following method:
TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList) const;
First three parameters are copied as the process border is crossed? But what happens with the fourth parameter anEntryList?
From the description of the function "The function sets anEntryList to NULL, then allocates memory for it before appending entries to the list. Therefore, anEntryList should have no memory allocated to it before this function is called, otherwise this memory will become orphaned." you get an impression that the server and client can share memory?
Or is it that kernel runs all applications as threads in a single process?
I found the docs related to this, and they were actually quite helpful (using asynchronous services @ inter process communication @ base @ application protocols @ C++ API guide @ Symbian OS guide @ deleloper libary).
Took some thinking though, in my opinion it's pretty complicated.