PC Review


Reply
Thread Tools Rate Thread

How to connect to a service

 
 
Patrick Sona
Guest
Posts: n/a
 
      11th Jul 2008
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
 
Reply With Quote
 
 
 
 
Eugene Mayevski
Guest
Posts: n/a
 
      11th Jul 2008
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/

 
Reply With Quote
 
Jeroen Mostert
Guest
Posts: n/a
 
      11th Jul 2008
Patrick Sona wrote:
> 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.

--
J.
 
Reply With Quote
 
Patrick Sona
Guest
Posts: n/a
 
      14th Jul 2008
Jeroen Mostert schrieb:
> Patrick Sona wrote:
>> 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.
>


Thanx for the both responses!

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

Greetings
Pat
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PPC Connect to Web Service Error Sam Microsoft Dot NET Compact Framework 0 13th Jun 2010 06:28 PM
How to connect to web service from C++ Manjunath.M Microsoft Dot NET 1 28th Apr 2008 01:08 PM
Windows The Windows Media Connect Service service failed to start due to the following error: Donald Bock Windows XP Help 1 5th Oct 2007 01:28 AM
can't connect to fax service Tarvirdi Microsoft Windows 2000 Fax 1 21st May 2006 04:55 PM
How to connect to a service? Vincent Finn Microsoft Dot NET 4 9th Dec 2004 06:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:51 PM.