0

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.

Vipin
  • 4,718
  • 12
  • 54
  • 81
  • [self.browser searchForServicesOfType:@""inDomain:@""]; what to use to get all device names in network – siva Jul 08 '14 at 09:28

1 Answers1

2

To stop a search, use the stop method. You should perform any necessary cleanup in the netServiceBrowserDidStopSearch: delegate callback.

Check this

Anton
  • 51
  • 2
  • 1
    i think stop method will not stop searching process .it will only Halts a service which is either publishing or resolving. – Vipin May 30 '11 at 15:13
  • i think the below delegate will trigger after i stop searching. - (void)netServiceBrowserDidStopSearch:(NSNetServiceBrowser *)aNetServiceBrowser; – Vipin May 30 '11 at 15:15
  • but no idea about how to stop search – Vipin May 30 '11 at 15:16
  • got it /* Stops the currently running search. */ - (void)stop; – Vipin May 30 '11 at 15:17