简体   繁体   中英

How can i stop the process of searching for new devices in wifi network?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM