• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Interprocess Communication (IPC) : Which "technology" to use?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interprocess Communication (IPC) : Which "technology" to use?


  • Subject: Re: Interprocess Communication (IPC) : Which "technology" to use?
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Tue, 7 Dec 2010 18:05:03 +0100

Le 7 déc. 2010 à 17:56, Keary Suska a écrit :

> On Dec 7, 2010, at 9:28 AM, Jerry Krinock wrote:
>
>> 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?
>
> If the data you are exchanging is fairly lightweight I can recommend shared memory segments. Decidedly un-Cocoa-like but very fast and reliable. DO is heavy and distributed notification are unreliable (per the documentation). In both cases you may need code to ensure reliability.
>

CFMessagePort is fine too to simply pass data from one process to an other. And it is far more cocoa-like as it is CF based.
And as it is a CFRunLoop source, it's easy to decide which thread send and receive messages.

-- Jean-Daniel




_______________________________________________

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

  • Follow-Ups:
    • Re: Interprocess Communication (IPC) : Which "technology" to use?
      • From: Jerry Krinock <email@hidden>
References: 
 >Interprocess Communication (IPC) : Which "technology" to use? (From: Jerry Krinock <email@hidden>)
 >Re: Interprocess Communication (IPC) : Which "technology" to use? (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Interprocess Communication (IPC) : Which "technology" to use?
  • Next by Date: Re: Problem instantiating an array
  • Previous by thread: Re: Interprocess Communication (IPC) : Which "technology" to use?
  • Next by thread: Re: Interprocess Communication (IPC) : Which "technology" to use?
  • Index(es):
    • Date
    • Thread