How to connect to a service

  • Thread starter Thread starter Patrick Sona
  • Start date Start date
P

Patrick Sona

Hi all!
I have written a small little windows-service. I can start and stop this
service in the service-snapin. So far all pretty nice!
But i need to controll this service. It is possible to send this service
an object (such as a string) an receive object (also a string, or
another object)?

The only what I have found yet is the ServiceController. With this class
I can connect to service an can get some information about it. i can
also shut down or start a service or can send a custom signal to it, but
I couldn't sent an object to the service.

Is there a way to do this?

Thanks for replies!

Greetings
Pat
 
Hello!
You wrote on Fri, 11 Jul 2008 15:58:07 +0200:

PS> The only what I have found yet is the ServiceController. With this
PS> class I can connect to service an can get some information about it. i
PS> can also shut down or start a service or can send a custom signal to
PS> it, but I couldn't sent an object to the service.
PS> Is there a way to do this?

There exists a number of ways to communicate between the processes:
* sockets
* named pipes
* memory-mapped files (shared memory)
* mailslots
* etc.

You can check MsgConnect ( http://www.eldos.com/msgconnect/ ) it was
designed for the tasks similar to yours and it lets you build flexible
communication via MMF or sockets.

With best regards,
Eugene Mayevski
http://mayevski.blogspot.com/
 
Patrick said:
I have written a small little windows-service. I can start and stop this
service in the service-snapin. So far all pretty nice!
But i need to controll this service. It is possible to send this service
an object (such as a string) an receive object (also a string, or
another object)?
You can use .NET remoting or WCF for this purpose, if your service and the
applications that control it are managed. This is by far the easiest
approach. Alternate approaches are one of the many unmanaged communication
mechanisms, mentioned by Eugene Mayevski.

Be careful in designing the interface to your service. Services usually run
at elevated privileges and pose a security risk if unprivileged clients can
control them in unexpected ways.
 
Jeroen said:
You can use .NET remoting or WCF for this purpose, if your service and
the applications that control it are managed. This is by far the easiest
approach. Alternate approaches are one of the many unmanaged
communication mechanisms, mentioned by Eugene Mayevski.

Be careful in designing the interface to your service. Services usually
run at elevated privileges and pose a security risk if unprivileged
clients can control them in unexpected ways.

Thanx for the both responses!

So I will try some of the IPC-methods. I think named-pipes do it for me!

Greetings
Pat
 
Back
Top