[launchd-dev] Help with launchd sockets chicken and egg problem

Dave MacLachlan dmaclach at gmail.com
Mon Nov 1 16:24:19 PDT 2010


Hey all...

I have my master process. It wants to spawn a child process that will startup automatically on reboot. I would like these processes to be able to communicate via sockets, but I don't want to hardcode a port, I would like to use "SecureSocketWithKey" and let launchd take care of starting my process on demand (and clean up the file system as appropriate).

Master process puts together a plist and installs it into LaunchAgents. It then calls launchctl and has it load it. The child process calls checks in and is able to get it's socket. How does the master process get the socket on it's end?

I understand that if I reboot the system that I can get the socket path via an environment variable, but how do I get it without rebooting?

Any info would be greatly appreciated.

Cheers,
Dave


More information about the launchd-dev mailing list