how to call the methods os windows service

ar_pad

Active member
Joined
Jun 5, 2006
Messages
26
Programming Experience
Beginner
Hi,

I'm new to this forum as well as to windows services.

Just i've created windows service called "Myserv1" and controlled(like start and stop) it via VB.NET windows client apps.

Now i want to write my own function calls in the windows service. i need to pass the parameters ( from normal client window apps) as well as need to get a value back from the function.

How to do it? Most importantly,how to access those methods from client programs. can anyone guide me?

Thank U!
 
user defined calls in windows service

Hi,

Thanks for ur valuable advice. Already i tested with service controller. It gives me status, machine name,start ,stop,etc...

But my requirement is different. let me explain little bit. Actually i want to write a service for card reader connected via serial port. The service needs to read the value from reader and pass it to my client apps .

Sometimes client application will send some datas to service. Service must write those datas into the reader.

Need to write two calls in service called

1) ReadData() - must return a value to client
2)Writedata() - must accept data from client and write into the reader.

Now my question is how can i call these two methods from client apps and pass arguments to service.

I'm very much struggling with this. Kindly advice me .

Thank You!
 
Windows Services were not designed for interaction with user, but for low level system service work. The only command interface that exist through the ServiceController is Start/Stop/Pause and the simple ExecuteCommand that supports a single integer flag to be signalled to the service (so it can be commanded to do action 1,2,3 etc).
You should be able to leave the data in the filesystem and tell/let the service to pick it up.
 
Yes John. U r correct. Now i'm saving the data in text file and developing the apps to pick up.

Thanks for support!
 
There are other channels to communicate with services too, but this is initially not like just calling a method with parameters. You got Remoting and Sockets for instance where you transfer byte data through TCP. To do this by Sockets you could look into how TcpListener/TcpClient works.
 
Back
Top