Add stop function to MDNSManager

This commit is contained in:
Cameron Gutman 2014-10-21 04:18:50 -04:00
parent b2236b5dad
commit f756451001
2 changed files with 7 additions and 1 deletions

View File

@ -20,6 +20,7 @@
- (id) initWithCallback:(id<MDNSCallback>) callback; - (id) initWithCallback:(id<MDNSCallback>) callback;
- (void) searchForHosts; - (void) searchForHosts;
- (void) stopSearching;
@end @end

View File

@ -31,10 +31,15 @@ static NSString* NV_SERVICE_TYPE = @"_nvstream._tcp";
} }
- (void) searchForHosts { - (void) searchForHosts {
NSLog(@"Searching for hosts..."); NSLog(@"Starting mDNS discovery");
[mDNSBrowser searchForServicesOfType:NV_SERVICE_TYPE inDomain:@""]; [mDNSBrowser searchForServicesOfType:NV_SERVICE_TYPE inDomain:@""];
} }
- (void) stopSearching {
NSLog(@"Stopping mDNS discovery");
[mDNSBrowser stop];
}
- (NSArray*) getFoundHosts { - (NSArray*) getFoundHosts {
NSMutableArray* hosts = [[NSMutableArray alloc] init]; NSMutableArray* hosts = [[NSMutableArray alloc] init];
for (NSNetService* service in services) { for (NSNetService* service in services) {