Get service run-time parameters

Dear Experts,

I have developed a Windows NT Service in VB using the NTSVCOCX control from MSDN. I now need to develop an application that can communicate with the service and allow me to change the service's run-time parameters in real time as well as view various statistics on the service. The service is implemented as an in-process DLL and it exposes various properties and methods to the host application. How best can I implement this?

NOTE: The services processes data in a database. Users capture data into the database, and the service checks for new information in one of the tables. Once there is new information in the table, the service sends an SMS to the Admin via a GSM modem. If the database connection is dropped, the service also notifies the Admin. Now I need to develop an application that should communicate with the service and shows the service's realtime statistics and configurations.
LVL 11
bmatumburaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grayeCommented:
Ouch, that might be hard to do, let me explain...

Services are multithreaded applications... with at least 2 threads.  VB doesn't natively support multi-threading (hince the need for the OCX control)

The OCX control doesn't provide the full functionality of a "native" service, just the bare-bones parts to make it "service-compliant".

By design, services do NOT expose properties and methods to the host application... instead you'd use the Service Control Manager to "talk" to the service.

Any serious communication between a host application and the service would be require a communication channel (shared memory, sockets, etc)

However, you might be able to communicate with your service via the shared database...  where you pass command to the service via a table entry, the service removes the commands from the table and performs that command, etc.   The service would just poll that table for new commands.

BTW:  This would be much easier with VB.Net (if that's an option).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bmatumburaAuthor Commented:
Since I have no options, let me do it the socket way so I can even run the application from another PC.
0
grayeCommented:
Yep, that's the "normal" way to communicate with a service.

One more thing... since your service (or perhaps a host program?) will be sending email (or SMS) it obviously needs access to the network.  Make sure the service is running under the context of a user that has network access.  By default, services are run with LocalSystem account which doesn't have valid credentials for networking.
0
bmatumburaAuthor Commented:
Thanks Graye,

This would have caused me a lot of problems.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.