in my wifi network code i am using a NSNetServiceBrowser delegate searchForServicesOfType which will starts a search for services of the specified type in the domain indicated by domainString
[self.netServiceBrowser searchForServicesOfType:types inDomain:domain]
my case type is network identifier(string:"_tcp_wifi") and domain is "local"(string).
For each service discovered, a -netServiceBrowser:foundService:moreComing: message is sent to the NSNetServiceBrowser instance's delegate.
- (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)service moreComing:(BOOL)moreComing { }
above delegate will trigger for each service discovered .
searchForServicesOfType delegate will always search for the new devices. however i need to stop the process of searching for new devices after 2 minutes using a timer.is it possible do this.is there any NSNetServiceBrowser delegate to do this? if yes 开发者_开发知识库,can any one tell me the good way to do it.
To stop a search, use the stop method. You should perform any necessary cleanup in the netServiceBrowserDidStopSearch: delegate callback.
Check this
精彩评论