OS X - Communication Between Launch Daemon and Launch Agent

I am new to OS X and must create an application that has 2 parts - a launch daemon and a launch agent. The daemon is about to do such things as executing commands, logging, etc., and must somehow pass these results to the launch agent (which will transfer them to the login element that displays the graphical user interface, although this will be the next step).

My question is: How do I achieve this communication ?. From what I have been able to compile so far after reading Apple documents, I prefer to use CFSockets. Is there an alternative (simpler) way? Does anyone have a sample tutorial / example / code that shows how to use CFSockets (I could not find)?

PS: My question may be a duplicate of this , but this question has not yet been answered, so I thought about publishing this post.

+4
source share
1 answer

I was able to configure the connection between my daemon and agent using CFSockets, and it was not as bad as I thought before. I followed the step-by-step instructions: https://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/UsingSocketsandSocketStreams.html (TCP-based server entry).

Perhaps you can also try using simple BSD sockets. There is a simple example: http://www.minek.com/files/unix_examples/poll.html (although I have not tried this).

Good luck.

+2
source

All Articles