Launching a parallel application
| Wed, 2004-06-09 21:58 | |
|
Hi I can't find a convenient solution for this problem : I have an "invisible" programm that is working in the background. Now I would like to launch another application ( like the HelloWorld GUI Example) from this initial programm, wait till the user has inputed something (For instance a choice in the Menu) and then return a data to my "invisible" programm. What would you be more suitable ? a RApaLsSession or to make EXPORTs in my HelloWorldGUI ? In this case I really don't know what should be exported...( the View, the Document ? ). Could someone help me to solve this problem ? Thanx a lot in advance MatD:-) MatD |
|






Forum posts: 52
This is very strange, though - are you sure the background process shouldn't be the server, and the GUI app the client?
Forum posts: 93
Ok I understand the principle on how client / server are working. I've tried to understand the examples at the Symbian website :
http://www.symbian.com/developer/techlib/v70sdocs/doc_source/devguides/cpp/base/interprocesscommunication/clientserver/HowToClientSideSessionWithCountServer.guide.html#ClientServerGuide%2ehow%2dto%2ecount%2dserver
I have several questions concerning this example :
- In RCountServ what it is the fundamental idea behind this example ? I can't figure out what I can do more than with other classes ? Here is the link to this example :
- The other thing I do not understand in the New Method of CCountServServer there is a PanicServer(ESvrCreateServer) method. Ok great but what does this method do ? Is this method implemented in my CCountServer ? If yes how do I know how to write it
- In CCountServerSession I haven't the smallest idea what to initialize in the constructor
Could someone give a link or a very tiny example on how to use this CSession / CServer and CSession because taking 1:1 the Symbian.com examples doesn't help me much
I just want to make this :
Client "tells" to Server : multiply(2,3) and Server returns 6
A little example like this would help me very much !!!!!
Thx a lot for your help !
MatD:-)
MatD
Forum posts: 52
-- RCountServ can't give you any advantage over normal objects. But if CCountServSession::iCount instead belonged to CCountServer, then you could have several processes co-operating to manipulate that piece of data. For instance.
-- Panic: the panic method should contain something like User::Panic(_L("MyServer"), aIntValuePassedIn). Ideally use _LIT not _L though.
-- CCountServerSession: I'm not sure either. Probably just a pointer to the server? The constructor is called by CCountServer::NewSessionL, so you can pass in a reference to the server.
Not easy stuff by any means.
Forum posts: 93
Thx for your advices. I will try to make the whole stuff work ! This kind of sessions and moreover the Symbian examples aren't very easy to understand for newbies
MatD
Forum posts: 100
The CCountServerSession is probalby the Server session object, that is a representation of the connection beetween the server and a particular client.
Regards, Aljaz
My app has a database, a recognizer (for autostart) and a server, these are all packaged into one plus a separate GUI app.
The server autostarts and checks the db and if there is any processing to do launches the GUI with some parameters so the GUI checks the db and does the processing.
It is working fine so far but the problem is if the GUI is already alive there is no way for the server to send an event to the GUI, cause in Client-Server solutions the server can't initiate communication.
Any idea how should the architecture be for my app/solution?
Thanks in advance.
I've finally understood how the whole stuff works. I'm very angry because I had to download the CodeWarrior Version of UIQ 2.1 in order to get an example explaining me how the session works. You can find this example under : examples\Base\IPC\ClientServer. It's a shame that there are so many interesting examples missing in the Borland Version
I've placed a zip with this example here : http://matdonline.free.fr/Session.zip
I've in built a little method SayHello that shows that a client->server communication is existing.
You create a client derived from RSessionBase. Then you use the Connect() method. It will create a Session to connect to your Server.
In RCountServ, you just need to put this method :
{
TAny *p[KMaxMessageArguments];
SendReceive(ECustomCode,&p[0]);
}
This ECustomCode then must be added to the Clientserver.h's TCountServRqst enum block. When this is done go CCountServSession::DispatchMessageL and add a ECustomCode case. Now you can call any methods set in CCountServSession.
With my "newbie" vision I would say the ClientServer.h makes a kind of link between the . It works as easy as Sockets ( after having understood the example lol)
To Guest :
Is the GUI necessary to check your database ?
A "not very good" solution would be that a two way communication would be set up. The GUI would be a server-client and your server would also provide a client interface.
I'm currently also trying to implement such a thing.
So as you mention "a two way communication" process is needed but how? Aren't servers not allowed to initiate requests? Theory says that server will only respond to requests!
What is your solution?
Thanks
Guest-Ariz
Forum posts: 93
I've tried to make an overview of a possible architecture. I also want to mention that I'm not a great expert in RSession and all this stuff, so this is just a starting point.
I think the server must contain a client and a server side. Both of them must internaly communicate. When communicating you can handle the incoming message and then reinterpret it into the client part of the server ( SCServerSession will send the messages)
To do this the SServer and SClient should inheritate Client and Server parts. Now two way communication should be possible.
In your GUI you can also define GServer and GClient classes and let themselves communicate with the Server ( and the client class of it).
In brief I would say Server must contain client and server sides and so the GUI.
I hope it'll help to solve your problem.
By the way you told that you managed to launch the gui through your server. How do you managed to do this ? How have you defined your entrypoint ? I'm hopelessly trying to launch the helloworld example from a "kind of server" but without any results.
MatD
MatD
Launching application was done quite simplistically; with a launch app command (I think). I don't have the code with me but I can chekc it up and get back to you.
Forum posts: 36
Let´s suppose that the server function is to listen on a socket on port 80.
In this case, would it be possible to have a J2ME GUI thah communicates with the server via socket??? HOW?
Ariz
Forum posts: 4
I am facing problem in writing client / server application.
I have come acroos sample codes SimpleClient and ComplexClient.
They are using Servers implemented in DLLs.
Somehow, my requirement is server should be running as separate application.
So I have convered Server DLL application into EXE.
Please let me know whow to run server and client exe one after another and test the communication.
Thanks
Rajesh!