[launchd-dev] Daemon & Network Availability?
kolpanic at voodooergonomics.com
Mon Nov 10 08:09:34 PST 2008
I'm working on a project comprised of a launchd daemon and a GUI
client app. I used the BetterAuthorizationSample project as a template
for installing and starting up the daemon the first time. In the
daemon's start-up code, it connects to a remote server. It all works
fine on installation. However, when I reboot my computer, the daemon
starts up, but the network isn't available yet, and the connection
I tried using SystemConfiguration notifications to receive changes to
the network state, but that doesn't work - the computer has an IP
address at that point, but the remote server is still not reachable. I
also tried setting the KeepAlive option in the daemon's plist to
NetworkState = true. However, that doesn't seem to work either - it
just starts as KeepAlive = true.
Is there some other way to indicate a dependency on the network? Do I
need a delay at start up to wait for a connection? For better or
worse, I used a named DO connection to handle IAC between the daemon &
GUI. Could this be part of the problem (the caveats in TN2083 lead me
to believe it's just inadvisable but not wrong outright)? Also, is
launchd checkin, etc., required? I did have it in main(), but it kept
failing, even though I had ServiceIPC = true. In case it helps, the
current daemon plist is below.
Karl Moskowski <kolpanic at voodooergonomics.com>
Voodoo Ergonomics Inc. <http://voodooergonomics.com/>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2441 bytes
Desc: not available
More information about the launchd-dev