Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Distributed Objects and Bonjour



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.