Bonjour will not resolve in separate thread
Bonjour will not resolve in separate thread
- Subject: Bonjour will not resolve in separate thread
- From: Will Koffel <email@hidden>
- Date: Sun, 9 Apr 2006 18:00:05 -0400
I'm trying to resolve a Bonjour service. It's happening in a
background thread.
[NSThread detachNewThreadSelector:@selector(loadData:)
toTarget:loader withObject:self];
The loader implements loadData, does nothing right now except
instantiate an autorelease pool and then try to resolve a service:
- (void)loadData:(id)caller {
NSAutoreleasePool *threadPool = [[NSAutoreleasePool alloc] init];
NSNetService *service = [[NSNetService alloc]
initWithDomain:@"local." type:@"_http._tcp."name:@"Steam"];
[service setDelegate:self];
[service resolveWithTimeout:5.0];
[threadPool release];
}
- (void)netServiceDidResolveAddress:(NSNetService *)sender {
NSLog(@"resolved %@", sender);
}
- (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary
*)errorDict {
NSLog(@"failed to resolve %@", sender);
}
- (void)netServiceWillResolve:(NSNetService *)sender {
NSLog(@"will resolve %@", sender);
}
I get the notification that the service "will resolve", but I never
get a resolution or a failure. If I do the same in the main thread,
it works with no problems.
Any ideas? The only thing I've found was a vague reference to
needing an NSRunLoop, but I'm pretty sure that the new thread's
default run loop will work.
-Will
_______________________________________________
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