NSConnection questions
NSConnection questions
- Subject: NSConnection questions
- From: Douglas Norton <email@hidden>
- Date: Tue, 20 Nov 2001 10:08:55 +0000
Dear All,
Background: I am writing something similar to a chat app, that needs to find
similar processes running on different Macs on the same subnet. I need a
wildcard search to find one other similar process, I do not have any
previous knowledge about the other clients on the network.
1. Am I right in thinking that this [below] does not work, as the @"*"
wildcard lookup is broken for searches over a subnet due to name server
complications?
id theProxy = [[NSConnection
rootProxyForConnectionWithRegisteredName:@"servedObject"
host:@"*"] retain];
2. My code to serve an object is:
NSConnection* theConnection = [NSConnection defaultConnection];
if ( theConnection )
{
[theConnection setRootObject: self];
if ( [theConnection registerName:@"servedObject"] == NO )
NSLog( @"Could not register servedObject.\n" );
else
// do the useful stuff here
}
else
NSLog( @"No [NSConnection defaultConnection].\n" );
How can I discover if this has worked, as I do not get the log messages,
i.e. Should this show up in the Network Utility port scan if I enter my own
IP address?
3. If I go down the route of using the example code posted by Chris Kane in
"DO over TCP sockets example for Mac OS X", how can I do the equivalent of a
wildcard search? Chris Kane's example takes the hostname as an argument to
the app when it is launched. I do not have this option, I have to find a
host programmatically.
Regards
Douglas J. Norton