[launchd-dev] Daemon & Network Availability?
nedly at mac.com
Mon Nov 10 09:09:29 PST 2008
I have a similar implementation, I think this is what you want, as one
who has been socket programming on Unix for 25 years I need to get my
head around not doing my own fd plumbing, rather trusting launchd to
do it for me. It also means you need to spend some time re-factoring
The presence of this key specifies that the daemon expects to be
run as if
it were launched from inetd.
This flag corresponds to the "wait" or "nowait" option of
true, then the listening socket is passed via the standard
in/out/error file descriptors. If false, then accept(2) is
behalf of the job, and the result is passed via the standard
On Nov 10, 2008, at 8:09 AM, Karl Moskowski wrote:
> Hello, all!
> 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 fails.
> 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
> <plist version="1.0">
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
More information about the launchd-dev