Interprocess Communication (IPC) : Which "technology" to use?
Interprocess Communication (IPC) : Which "technology" to use?
- Subject: Interprocess Communication (IPC) : Which "technology" to use?
- From: Jerry Krinock <email@hidden>
- Date: Tue, 7 Dec 2010 08:28:55 -0800
My application needs to communicate with my associated Internet Plugin (a bundle that runs in web browsers). For example, here is one sequence:
• App sends a "hello" to the plugin.
• Plugin processes "hello", responds to app, indicating that it is installed and alive.
• App sends up to a few hundred KB to the plugin.
• Plugin sends a few tens of KB back to the app.
This may happen several times a day.
Apple documentation seems to be steering me into Distributed Objects (DO) for this. But DO are so complicated! There are vended objects, proxies, connection configurations, etc. Looks like I'd have to study it for a week or more. Since the web browser talks in JSON-encoded strings anyhow, I don't need to send any Cocoa objects; just bytes are fine.
Trying to use what I know, I've been using NSDistributedNotificationCenter to send little messages, and when there is significant data, the sender writes the data to a temporary file and sends the temporary file's path as userInfo in the notification. Upon receiving the notification, the receiver reads the file; end of story.
This seems to work OK, except for the minor annoyance of distributed notifications always arriving on the main thread and needing to be forwarded. I was thinking that maybe I should use NSPort since I've had some experience with it, but NSPort documentation advises that "You should implement interapplication communication using distributed objects whenever possible and use NSPort objects only when necessary." Why is that?
How should I be doing this?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden