| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Hi all, I'm hoping someone on the list can help. Beginning with Tiger and continuing on OS X 10.4.1, my resolve callback no longer gets called when I call CFNetServiceResolve in asynchronous mode. This had been working fine through previous system versions. I'm not doing anything fancy - most of the code is almost straight from one of Apple's samples. I've tried searching the archives for CFNetServiceResolve to no avail. Here's the relevant code: CFNetServiceClientContext clientContext = { 0, this, NULL, NULL, NULL }; CFStreamError error; CFStringRef svcName = /* a name obtained from browsing services */; CFNetServiceRef resolveSvc = CFNetServiceCreate(kCFAllocatorDefault, kDomainStr, mServiceTypeStr, svcName, 0); if (resolveSvc == NULL) return; if (CFNetServiceSetClient(resolveSvc, MyResolveCallback, &clientContext)) { CFNetServiceScheduleWithRunLoop(resolveSvc, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); bool resolutionStarted; if (TigerOrLater()) resolutionStarted = CFNetServiceResolveWithTimeout(resolveSvc, (CFTimeInterval)20, &error); else resolutionStarted = CFNetServiceResolve(resolveSvc, &error); if (resolutionStarted) { CFRunLoopRun(); } else { // Something went wrong so lets clean up. CFNetServiceUnscheduleFromRunLoop(resolveSvc, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); CFNetServiceSetClient(resolveSvc, NULL, NULL); CFRelease(resolveSvc); } } MyResolveCallback (which never gets called) is declared like this: void MyResolveCallback(CFNetServiceRef service, CFStreamError* /*error*/, void* info); I had heard there were differences between CFNetServiceResolve and the newer WithTimeout version. I only added the check for TigerOrLater() and the call to the WithTimeout variant after this stopped working. Oddly, that one always returns false while CFNetServiceResolve returns true. The call to CFRunLoopRun was also added afterwards during my attempts to find out what's going wrong here. Also, it doesn't seem to matter if the given name contains any punctuation or other characters. The code continues to work fine on Panther... Thanks in advance for any help. I hope someone spots something obvious. I'm at a little bit of a loss :) Ken |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bonjour-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bonjour-dev/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.