Dear Erwin Namal,
I strongly believe that resorting to Distributed Objects on a daemon is not the way to go. If not implemented properly [1] DOs will leave your daemon vulnerable to all sorts of bugs and it will open the door to attacks (DOS by crashing the daemon and possibly propagate the crash to any connected client). Also, by implemented properly, I mean dealing with the fact that a connection can silently be dropped without you knowing. That almost any call to a remote object may throw an exception, that you can't reasonably count on any sync returned value, etc.. By the time you have set up all the code required to handle DOs safely, you will probably have lost interest in them [1].
Since you want a system-wide daemon, you could try the NSXPConnection family. But from the looks of it, you need an XPC service for that, and an XPC service is not a system-wide daemon. Then there are unix domain sockets. Look ancient. Written by Quinn (eskimo1) in 2005. Now, marked as deprecated [2]. You could also explore NSConnection with NSSocketPort on AF_UNIX or take a look at XPC APIs [3].
Jean
[2] Important: This document is part of the Legacy section of the ADC Developer Library. This information should not be used for new development
-----------Jean Suisse Institut de Chimie Moléculaire de l’Université de Bourgogne (ICMUB) — UMR 6302
Thank you for your reply. I checked out distributed objects after posting my message, and thought I could make it work in the direction user application (proxy) → daemon (real object), I couldn't make it work in reverse. So I was left with the only possibility: polling the daemon for logs instead of waiting for them.
The scheme I used is contact a distant object owned by the daemon (works) to tell it to call me back at an address for logging purposes. Thought the launchd system-wide daemon had the address, it was unable to establish a connection. Is there a reason for that?
-E
The simplest Objective-C way to communicate would be distributed objects. It is not, of cause, the most secure way - but definitely the simpliest one.
XPC is based on DO
No, it isn't. -- Damien Sorresso email@hidden
but has additional security features (e.g. for data validation) to make it safe to use between mutually-untrusted processes. (Again, this is my understanding from reading overview docs. I haven't used it myself.)
|