• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

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.
0
bmatumbura
Asked:
bmatumbura
  • 2
  • 2
1 Solution
 
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
 
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now