FROM : Jordan Evans
DATE : Fri Jul 21 22:03:36 2006
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."];
}
DATE : Fri Jul 21 22:03:36 2006
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."];
}
| Related mails | Author | Date |
|---|---|---|
| No related mails found. | ||






Cocoa mail archive

