Hi Karl, 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 your code. inetdCompatibility <dictionary> The presence of this key specifies that the daemon expects to be run as if it were launched from inetd. Wait <boolean> This flag corresponds to the "wait" or "nowait" option of inetd. If true, then the listening socket is passed via the standard in/out/error file descriptors. If false, then accept(2) is called on behalf of the job, and the result is passed via the standard in/out/error descriptors. 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.
Thanks.
---- Karl Moskowski <kolpanic@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"> <dict> <key>KeepAlive</key> <dict> <key>NetworkState</key> <true/> </dict> <key>Label</key> <string>com.company.myd</string> <key>ProgramArguments</key> <array> <string>/Library/PrivilegedHelperTools/com.company.myd</string> </array> </dict> </plist>
_______________________________________________ launchd-dev mailing list launchd-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev