Which windows service controls network?

I'm writing a service which is running into the following error on startup, but works fine when I restart the service a few minutes later:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

I'm guessing the problem is that my service is starting before the network connections are established, so I did some digging and it seems you can set service dependencies in the registry. My question is which service should I set my service to depend on to resolve my issue? I tried Dhcp but no luck... I don't really know much about hardware/networking so any help is appreciated (if there is a better way to solve my issue that would be great as well).

Posted Feb 12, 2013, 9:36 PM UTC

24
[deleted]•

Couldn't you just catch that exception, wait a short bit, and try again?

Alternatively, you can configure a windows service to start automatically after a delay. That might be enough.

2
mathfutureOP•

The delay start setting only works on vista and beyond, however I need it to work for XP as well. I also tried your first method, but it didn't work and my guess is that for some reason windows is waiting for my service to run before attempting to establish a network.

1
[deleted]•

That doesn't sound good...

Is it in the Service initialize that you tried (as in, services.msc would still be showing its progress bar and saying that it's attempting to start the service)?

If so, could you move the network bits out of there, and just try to get a connection at some later time?

2
The_One_Above_All•

DISCLAIMER: I am not a programmer, so this may not help you at all. That said, take a look at Process Monitor.

Overview of Process Monitor Capabilities

Process Monitor includes powerful monitoring and filtering capabilities, including:

More data captured for operation input and output parameters
Non-destructive filters allow you to set filters without losing data
Capture of thread stacks for each operation make it possible in many cases to identify the root cause of an operation
Reliable capture of process details, including image path, command line, user and session ID
Configurable and moveable columns for any event property
Filters can be set for any data field, including fields not configured as columns
Advanced logging architecture scales to tens of millions of captured events and gigabytes of log data
Process tree tool shows relationship of all processes referenced in a trace
Native log format preserves all data for loading in a different Process Monitor instance
Process tooltip for easy viewing of process image information
Detail tooltip allows convenient access to formatted data that doesn't fit in the column
Cancellable search
Boot time logging of all operations

The best way to become familiar with Process Monitor's features is to read through the help file and then visit each of its menu items and options on a live system.

I have used Process Monitor to figure out when and why an application I am trying to run results in errors. Sometimes an app requires a certain file that it cannot find, or a registry key may not exist, etc.

I also use Process Explorer, which lets me see which processes are running, and their relationships to other processes. If you hover your mouse over a process name, a tooltip will show you the command-line commands/switches that are processed when it starts. For example, Process Explorer shows that "C:\WINDOWS\system32\svchost.exe -k NetworkService" deals with the networking services. That's the best I can do for you.

2