Difference between revisions of "NSNetServiceBrowser"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
 (stub)  | 
				 (add example)  | 
				||
| Line 4: | Line 4: | ||
Each '''NSNetServiceBrowser''' performs one search at a time. So in order to perform multiple searches simultaneously, create multiple instances.  | Each '''NSNetServiceBrowser''' performs one search at a time. So in order to perform multiple searches simultaneously, create multiple instances.  | ||
| + | |||
| + | == How to discover all service types in all domains ==  | ||
| + | |||
| + | To discover all service types in all domains use  | ||
| + | |||
| + |  NSNetServiceBrowser *browser = [[NSNetServiceBrowser alloc] init];  | ||
| + | |||
| + |  [browser setDelegate: self];  | ||
| + |  [browser searchForServicesOfType: @"_services._dns-sd._udp."  | ||
| + |                          inDomain: @""];  | ||
| + | |||
| + | If you want a specific domain then set domain appropriately.  | ||
[[Category:Foundation]]  | [[Category:Foundation]]  | ||
| + | [[Category:Snippets]]  | ||
Revision as of 18:13, 7 January 2007
| This article or section is a stub (i.e., in need of additional material). You can help us by expanding it  | 
|---|
NSNetServiceBrowser asynchronously lets you discover network domains and, additionally, search for a type of network service. It sends its delegate a message whenever it discovers a new network service, and whenever a network service goes away.
Each NSNetServiceBrowser performs one search at a time. So in order to perform multiple searches simultaneously, create multiple instances.
How to discover all service types in all domains
To discover all service types in all domains use
NSNetServiceBrowser *browser = [[NSNetServiceBrowser alloc] init];
[browser setDelegate: self];
[browser searchForServicesOfType: @"_services._dns-sd._udp."
                        inDomain: @""];
If you want a specific domain then set domain appropriately.