[英]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在我的 wifi 网络代码中,我正在使用NSNetServiceBrowser委托searchForServicesOfType它将开始在 domainString 指示的域中搜索指定类型的服务
[ self.netServiceBrowser searchForServicesOfType:types inDomain:domain] [ self.netServiceBrowser searchForServicesOfType:类型 inDomain:domain]
my case type is network identifier(string:" _tcp_wifi ") and domain is " local "(string).我的案例类型是网络标识符(字符串:“ _tcp_wifi ”),域是“本地”(字符串)。
For each service discovered, a -netServiceBrowser:foundService:moreComing: message is sent to the NSNetServiceBrowser instance's delegate.对于每个发现的服务,一个 -netServiceBrowser:foundService:moreComing: 消息被发送到 NSNetServiceBrowser 实例的委托。
- (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)service moreComing:(BOOL)moreComing { } - (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. searchForServicesOfType委托将始终搜索新设备。 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?
但是我需要使用计时器在 2 分钟后停止搜索新设备的过程。是否可以这样做。是否有任何 NSNetServiceBrowser 委托来执行此操作? if yes,can any one tell me the good way to do it.
如果是的话,谁能告诉我这样做的好方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.