Re: Can server send message to client through NSConnection
Re: Can server send message to client through NSConnection
- Subject: Re: Can server send message to client through NSConnection
- From: Brendan Younger <email@hidden>
- Date: Wed, 28 Nov 2001 14:01:00 -0500
On Wednesday, November 28, 2001, at 12:28 PM, email@hidden wrote:
Hello all,
For NSConnection in documentation, it seems only client application can
send message(defined in protocol for proxy) to server application
through proxy it get for server application. But my situation is the
server application will obtain some data from time to time, and I hope
server application will send the data to client application as soon as
it get these data instead of client application keep asking about the
data(sometimes server may have, sometimes may not). That is, can server
send message to client when the data is ready?
Certainly, the way this is usually done is to first have the server set
itself as the root object of the connection, having the client retrieve
the proxy through one of those -rootProxy messages, and then either set
itself (the client) as the root object and send a message back to the
server that it's done initializing and have the server retrieve the root
proxy which now points to the client or to simply send the server a
message with itself as one of the arguments such as [serverProxy
doneIntializing:self];. Then the server has a local reference to the
client object. (It's really a proxy you specify bycopy.)
Although for the purposes of your set-up it makes sense to have a
server/client relationship, DO does not force that distinction.
Brendan Younger