Click to See Complete Forum and Search --> : how to communicate between an application and a windows service..


just_starting
February 1st, 2005, 02:59 PM
Hi all,

How to communicate between an application and a windows service on the same machine.

Here I want to access data generated by service and process it through an application(UI).

Thanks..

atkin
February 2nd, 2005, 12:31 AM
hi
i guess you can have a look at it from the log file of one exist.
if its an application that you have the source code then you can let your project control it, ie
use the lib and then start the process and even add some more code to get the debug information.
if you dont have the code, then search for teh dll and lib file and try to start and stop the process and then call some functions and log some information .
hope this helps, your question is a bit sketchy.

boudino
February 2nd, 2005, 01:21 AM
If it is your windows service, use remoting. Service will expose an object trought remoting and UI will consume it. If the service don't support remoting (e.g. it is not .NET) and you cannot adapt it, I afraid there is no way. If an author of the service don't provide such a facility.

just_starting
February 2nd, 2005, 02:38 AM
Hi all,
To clear some confusion I want to tell that both the application and service are in C# and made by me.

So, as Boudino has suggested I'll try using remoting. If any one else has any other solution or suggestion please post here.

ps:Am I be able to exchange data in both way, from service to application and also from the application to the service.

With thanks.

darwen
February 2nd, 2005, 04:19 AM
There are loads of ways of doing this : in fact I believe that there's an FAQ in the C++ forum on this very subject.

Here's a few off the top of my head which might be simpler than using remoting :

(1) Message Lists.
(2) Named Pipes.
(3) Polling of a file (i.e. get server to look at a file every so often to see if it's changed or use FileSystemWatcher). This is good for configuration changes.

Lots more of course...

Darwen.