Distributed Objects and Bonjour
Distributed Objects and Bonjour
- Subject: Distributed Objects and Bonjour
- From: Robert Sesek <email@hidden>
- Date: Mon, 26 Jun 2006 11:37:24 -0700
Hello,
I'm trying to get Distributed Objects and Bonjour to work together.
I've found various examples of these two items working independently,
but I cannot seem to get them to work together.
TI can broadcast and browse my Bonjour service and I setup my D-O
system like this:
- (void)startDistributedObject
{
connection = [NSConnection connectionWithReceivePort: socket
sendPort: nil];
[connection setRootObject: [manager dbConnector]];
[[NSSocketPortNameServer sharedInstance] registerPort: socket
name: @"TindexServer"];
}
In the client, I browse for services and I have an NSMutableArray of
NSNetService's that are of the service type _tindex._tcp. When
somebody wants to connect to the server this method is executed (by
clicking on a button):
- (IBAction)connectToServer: (id)sender
{
id proxy;
NSData *addy;
if ([serverList indexOfSelectedItem] != 0)
{
netService = [servers objectForKey: [serverList titleOfSelectedItem]];
NSLog(@"selected service: %@", netService);
socket = [[NSSocketPortNameServer sharedInstance] portForName:
@"TindexServer"
host: [netService name]];
connection = [NSConnection connectionWithReceivePort: nil
sendPort: socket];
//proxy = [connection rootProxy];
addy = [socket address];
NSLog(@"socket = %@", socket);
NSLog(@"ipaddy = %@", [socket address]);
NSLog(@"connection = %@", connection);
//NSLog(@"proxy = %@", proxy);
}
else
{
NSLog(@"Current selection: <none>");
}
}
This above is the problemed code. I have no idea why this isn't
working. When I uncomment the two lines above, then I get a crash.
I've tried searching for so many examples, but can't find anything
that works.
Any help or advice would be appreciated.
Robert Sesek
Email: email@hidden
www.iris-studios.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden