NSDistantObject for Machine to Machine DO
NSDistantObject for Machine to Machine DO
- Subject: NSDistantObject for Machine to Machine DO
- From: "Jordan Evans" <email@hidden>
- Date: Fri, 21 Jul 2006 13:03:36 -0700
I'm trying to set up server/client apps for distributing objects.
I can't seem to get the client proxy to work. My server app shows up
in Bonjour fine. But, my client icon only bounces in the dock after
execution. How do I get this proxy to work?
/* MY SERVER CODE */
- (id)init
{
self = [super init];
if ( self )
{
port = [[NSSocketPort alloc] init];
connection = [NSConnection connectionWithReceivePort:port sendPort:nil];
[[NSSocketPortNameServer sharedInstance] registerPort:port name:@"server"];
}
return self;
}
- (void)printString:(NSString *)message
{
printf("%s\n", [message cString]);
}
/* MY CLIENT CODE */
- (id)init
{
self = [super init];
if ( self )
{
port = [[NSSocketPortNameServer sharedInstance]
portForName:@"server" host:@"*"];
connection = [NSConnection connectionWithReceivePort:nil sendPort:port];
proxy = [[connection rootProxy] retain];
}
return self;
}
- (IBAction)sayHelloToTheServer:(id)sender
{
[proxy printString:@"hello from a distance."];
}
_______________________________________________
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