views:

243

answers:

3

Possible Duplicate:
Delphi 2009: How to communicate between Windows service & desktop application under Vista?

I have a server running as a Windows service. To control the service and to display it's state I have an application running as a tray icon. I would like to pass data (log strings) from the service to the application.

What's the best way to do this?

+1  A: 

Use any kind of SOAP implementation, it shoudl be flexible enough to provide you with certain extensibility for the future and to provide you with the ability to connect from other location/applications.

Webservices are a good option.

Jorge Córdoba
Yes in certain scenarios, when you need cross language / platform compatibility. But SOAP is slow and for fast IPC between two processes on the same machine it is overkill.
Runner
I agree, but if you're not to performance bound I'd say the extra flexibility (as in being able to monitor your application remotely) compensates the slight drop in performance.
Jorge Córdoba
Yes if you want to control the application or monitor it, then SOAP is a good solution as any other TCP/IP based solution probably is.
Runner
+2  A: 

There are many options for interprocess communication. http://en.wikipedia.org/wiki/Inter-process_communication

I tend to use sockets, with HTTP and HTML. This way I may use a browser to control my service. Even remotely.

PA
The list is far from complete. It lists the most used and cross platform methods, but on windows we have many more. Mail Slots, COM, etc...
Runner
+2  A: 

The best approach here is IPC based on Named Pipes. TCP/IP is also a very good solution but it is slower than Named Pipes. Named Pipes also work over computer in a LAN.

You can use my implementation which is packet oriented and hides all technical details from you. Download is available at: http://www.cromis.net/blog/downloads/cromis-ipc

Runner