Launching a parallel application

Login to reply to this topic.
Wed, 2004-06-09 21:58
Joined: 2003-12-30
Forum posts: 93
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


Wed, 2004-06-09 23:15
Joined: 2004-05-28
Forum posts: 52
I think you need a server
Don't try to export anything, that won't work as the background process and the GUI application will be in different processes. You need some form of inter-process communication. So create a CServer in your GUI application, and some sort of RSessionBase-derived object in your background process, to communicate with it. The background process will make a request to the foreground app, passing in a TRequestStatus, which the foreground application can RequestComplete when it has finished. Something in the background application will then RunL.

This is very strange, though - are you sure the background process shouldn't be the server, and the GUI app the client?
Thu, 2004-06-10 17:52
Joined: 2003-12-30
Forum posts: 93
Launching a parallel application
Hi

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 Huh CServer is abstract so I must write everything myself...

- In CCountServerSession I haven't the smallest idea what to initialize in the constructor Sad

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 Sad it's too unclear for a newbie lol

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

Thu, 2004-06-10 21:52
Joined: 2004-05-28
Forum posts: 52
Yeah, it's not very clear
I can't help too much either.

-- 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.
Fri, 2004-06-11 11:10
Joined: 2003-12-30
Forum posts: 93
Launching a parallel application
Hi

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 Sad

MatD

Fri, 2004-06-11 12:12
Joined: 2003-10-22
Forum posts: 100
Launching a parallel application
Hey,

The CCountServerSession is probalby the Server session object, that is a representation of the connection beetween the server and a particular client.

                                               Regards, Aljaz
Fri, 2004-06-11 12:20
Anonymous (not verified)
Forum posts: 2043
Launching a parallel application
I have a related problem and haven't yet got down to solving it, can you please help me with some conceptual help?

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.
Fri, 2004-06-11 14:04
Anonymous (not verified)
Forum posts: 2043
Launching a parallel application
Hi !

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 :

Code:
RCountServ::myMethod()
{
 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.
Fri, 2004-06-11 16:39
Anonymous (not verified)
Forum posts: 2043
Launching a parallel application
Yes the GUI is necessary but it doesn't check the db, the server checks the db and writes some tasks to a file and then launches the gui with some params, this action leads the gui to check the file and complete the tasks. It is this way because the server contains a timer and it needs to be running all the time, we can't guarantee that with a GUI app. Now the problem is that if the GUI is already open, the launch from server will not happen. What I can do is write a timer in the GUI too, so if GUI is open then it will check the db based on the timer. But this is not very elegant.

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
Tue, 2004-06-15 15:53
Joined: 2003-12-30
Forum posts: 93
Launching a parallel application
Hi Ariz

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

Wed, 2004-06-16 11:48
Anonymous (not verified)
Forum posts: 2043
Launching a parallel application
Thanks for that mate, I will give this method a shot.

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.
Thu, 2004-07-08 19:06
Joined: 2003-12-12
Forum posts: 36
Launching a parallel application
Hi!!

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?Huh?



Evil
Fri, 2004-07-09 08:26
Anonymous (not verified)
Forum posts: 2043
Launching a parallel application
Yes it is possible, don't exactly know how but if J2me lets you open a socket connection you can communicate with a C++ program over a listening port.

Ariz
Thu, 2006-04-06 13:07
Joined: 2006-03-23
Forum posts: 4
Re: Launching a parallel application
Hi,

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!
  • Login to reply to this topic.