I tried using an NSSocketPort to get a port for the NSNetService and DO, just out of curiosity. This code creates a service that shows up in the browse list, until I added the final assertion. So receivePort is still valid, but the NSSocketPortNameServer returns a port that's not valid (or maybe nil...I didn't check).
So even if there is a way to make it work by eliminating NSSocketPortNameServer, I'd hate to say whether it worked by accident or design, DO being what it is :). #import <Foundation/Foundation.h> #import <sys/socket.h> #include <netinet/in.h> #include <unistd.h> int main (int argc, char const *argv[]) { NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSString *sharingName = @"DO test name"; NSPort *receivePort = [NSSocketPort port]; BOOL didRegister = [receivePort isValid] && [[NSSocketPortNameServer sharedInstance] registerPort:receivePort name:sharingName]; NSCParameterAssert(didRegister); int fd = [(NSSocketPort *)receivePort socket]; NSCParameterAssert(fd >= 0); const struct sockaddr_in *saddr = [[(NSSocketPort *)receivePort address] bytes]; uint16_t port = ntohs(saddr->sin_port); NSLog(@"port = %d", port); NSNetService *service = [[NSNetService alloc] initWithDomain:@"" type:@"_bdsk._tcp." name:sharingName port:port]; NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:4]; [dictionary setObject:@"0" forKey:@"txtvers"]; [dictionary setObject:@"NO" forKey:@"authenticate"]; [dictionary setObject:@"dummy" forKey:@"ident"]; [service setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:dictionary]]; [service publishWithOptions:0]; NSCParameterAssert([receivePort isValid]); NSCParameterAssert([[[NSSocketPortNameServer sharedInstance] portForName:sharingName] isValid]); [[NSRunLoop currentRunLoop] run]; [pool drain]; return 0; } ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Bibdesk-develop mailing list Bibdesk-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-develop