OK, I'm back. I have some distributed object code that used to work just great (back in the Tiger days, I think), and now does not. I see the error: "[NSPortCoder sendBeforeTime:sendReplyPort:] timed out", when I try to get the rootProxy from a connection. I see this mentioned here and there on various mailing lists, but haven't seen any solution.
I need to provide a DO across a network. The simple code Apple provides in the DO programming guide does work on a single machine: vend it /* Assume serverObject has a valid value of an object to be vended. */ NSConnection *theConnection; theConnection = [NSConnection defaultConnection]; [theConnection setRootObject:serverObject]; if ([theConnection registerName:@"server"] == NO) { /* Handle error. */ } get it id theProxy; theProxy = [[NSConnection rootProxyForConnectionWithRegisteredName:@"server" host:nil] retain]; [theProxy setProtocolForProxy:@protocol(ServerProtocol)]; But if one initializes the connection with an NSSocketPort, which is required if one wants to talk beyond a single machine, the registerName message fails. So, I whip out the code that used to work. The few relevant parts listed below: vend it: conduitPort = [[NSSocketPort alloc] init]; myConduit = [[ServerConduit alloc] init]; conduitConnection = [[NSConnection alloc] initWithReceivePort:conduitPort sendPort:nil]; [conduitConnection setRootObject:myConduit]; get it: - (void)netServiceDidResolveAddress:(NSNetService *)netService{ struct sockaddr *address; NSConnection* theConnection; NSSocketPort* thePort; NSSocketPort* socket; printf("\resolved address\n"); socket = [[NSSocketPort alloc] init]; if([[netService addresses] count] > 0){ address = (struct sockaddr *)[[[netService addresses] objectAtIndex:0] bytes]; thePort = [[NSSocketPort alloc] initRemoteWithProtocolFamily:address->sa_family socketType:SOCK_STREAM protocol:0 address:[[netService addresses] objectAtIndex:0]]; theConnection = [[NSConnection alloc] initWithReceivePort:nil sendPort:thePort]; [thePort release]; id theProxy = [theConnection rootProxy]; }else{ NSLog(@"Could not find an address for the service."); } } When I call rootProxy, I get the time out error. Does anyone have a dirt-simple sample app I can look at that vends, and gets, a DO over a network on 10.5 or later?! Thanks for the help, Eric _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com