From: Richard Frith-Macdonald <richard@brainstorm.co.uk>
To: "Yen-Ju Chen" <yjchenx@hotmail.com>
CC: help-gnustep@gnu.org
Subject: Re: Communication between applications
Date: Thu, 10 Oct 2002 06:20:56 +0100
On Thursday, October 10, 2002, at 02:50 am, Yen-Ju Chen wrote:
Hi,
How could two applications communicate with each other ?
It seems the NSNotification only work _WITHIN_ an application itself.
Should I use DO to do that ?
The situation is that I have two applications: MusicBox and Mixer.
When I change something in MusicBox,
I need to notify Mixer that something changed,
and vice versa.
NSNotification seems not to work in this situation.
You have a few options - depending on how flexible the communication needs
to be ...
If the apps just need to send simple notifications with only string data,
you can use an NSDistributedNotificationCenter.
If the apps need to exchange information with a variety of well defined
types,
you can set up an NSPasteboard to pass the data.
If the apps need to actually send messages to each other and interoperate
very closely, you need to use NSConnection (the other two mechanisms are
implemented on top of NSConnection and using an intermediary server
process ... so direct use of NSConnection is more work to code, but is
more powerful and more efficient).