• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSDistantObject for Machine to Machine DO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: First-responder action in TextEdit
  • Next by Date: Re: Turn off duplicate method warning
  • Previous by thread: Re: Assembly view
  • Next by thread: Exception in NSTreeController:removeObjectAtArrangedObjectIndexPath
  • Index(es):
    • Date
    • Thread