Re: NSNetServiceBrowser when a search finds nothing
Re: NSNetServiceBrowser when a search finds nothing
- Subject: Re: NSNetServiceBrowser when a search finds nothing
- From: Josh Graessley <email@hidden>
- Date: Thu, 16 Nov 2017 12:47:53 -0800
> On Nov 16, 2017, at 12:38 PM, James Walker <email@hidden> wrote:
>
> On 11/16/2017 10:58 AM, Josh Graessley wrote:
>> The search is never finished until you decide it is by cancelling the browse.
>>
>> Bonjour sends multicasts queries with an exponential backoff, up to some
>> maximum amount of time. When a Bonjour service is advertised/registered on
>> an interface, a multicast is sent out as well. As long as you have that
>> browser open, Bonjour will keep watching for a matching service to appear,
>> either as a response to one of the multicasts it sends or through an
>> announcement sent by a device arriving on the networking or starting the
>> service.
>>
>> The only alternative is a timeout and timeouts are bad.
>
> Maybe I didn't make it clear enough what I'm looking for. If the delegate
> receives a netServiceBrowser:didFindService:moreComing: message with NO for
> the moreComing parameter, that means *something*, right? Sure, there could
> be unusual circumstances causing delayed notification about some service, and
> more services could come online later, but I probably have the whole story
> for now. That's the kind of "that's probably it for now" information I'd
> like to have in the case where there are no services.
The moreComing is there to help you optimize your code. The delegate is called
once per service. In some cases, there may be multiple services that need to be
delivered to the delegate. When this is the case, moreComing is set so to let
the delegate know that it’s safe to suppress UI updates or other expensive
operations because there’s another service immediately following this one. If
moreComing is not set, that doesn’t mean there won’t be more services
discovered. It just means that there aren’t any more matching services
immediately ready to be delivered to your delegate.
>> On Nov 16, 2017, at 10:36 AM, James Walker <email@hidden>
>> <mailto:email@hidden> wrote:
>>>
>>> If I use -[NSNetServiceBrowser searchForServicesOfType:inDomain:] and there
>>> happen to be no services of the specified type, my delegate gets
>>> netServiceBrowserWillSearch:, but nothing else. How can I know when the
>>> search is finished?
>>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden