Share via

How do I make the service activated on incoming connections?

2023-01-20T04:06:02.6133333+00:00

The following link provides a minimal example of the implementation of the service (from Microsoft): minimal example link During the creation of the service (calling the CreateService function), the dwStartType parameter is specified, which can take one of the following values:

  • SERVICE_AUTO_START
  • SERVICE_BOOT_START
  • SERVICE_DEMAND_START
  • SERVICE_DISABLED
  • SERVICE_SYSTEM_START

I am interested in whether it is still possible to create a service that launched only when an incoming connection is requested on a certain port (socket activation), and the rest of the time the service is not even loaded into RAM? For example, it would be great for the service to get the necessary descriptor from the service manager in order to then just accept() the connection.

Windows development | Windows API - Win32
Windows for business | Windows Client for IT Pros | User experience | Other

Answer accepted by question author
  1. RLWA32 52,441 Reputation points
    2023-01-20T09:13:18.45+00:00

    Windows services can also be configured to start when certain trigger events occur. There are a number of predefined trigger types and the system also provides for the use of custom user supplied triggers. For more information refer to the following

    Service Trigger Events

    https://learn.microsoft.com/en-us/windows/win32/services/service-trigger-events

    Service Trigger Structure

    https://learn.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_trigger

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.