Re: NSConnection questions
Re: NSConnection questions
- Subject: Re: NSConnection questions
- From: Eric Peyton <email@hidden>
- Date: Tue, 20 Nov 2001 09:05:01 -0600
On Tuesday, November 20, 2001, at 04:08 AM, Douglas Norton wrote:
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];
Yes, you are correct in thinking this will not work.
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?
Why not just add an NSLog to the // do useful stuff section. If you are
using Chris's example, you may or may not see port 15550 open, I'm not
sure.
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?
You don't.
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.
Then you are going to need a server that vends the ip names that are
valid, or you will need to write your own search to find the valid
hosts. Anyway it works, you need to know some information before more
information can be discovered, there is no longer any wildcard
functionality in DO.
Eric
Regards
Douglas J. Norton
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev