Bonjour Question

One of my apps uses Bonjour to discover devices on a network. I’m using Christian’s MBS classes (DNSServcieBrowseMBS, etc) for discovering and resolving devices. That works great. My problem is more about what happens when you have a network topology change.

So for example, if you have a Mac, in Safari, open preferences and go to the advanced tab. Choose “Include Bonjour in Favorites Bar.” Now, you have a Bonjour drop down and can see all the Bonjour aware devices on your network. Now go into your network settings and change your IP address to something that is NOT in your LAN. Now go back and look at your Bonjour devices in Safari - they all are still there. And they will be there for some time.

I’d like to know if there’s a way to refresh or restart Bonjour so that network topology changes no longer show devices that should not be there. Yes, they will eventually drop off but I’ve seen them hang about for quite a while. Christian’s methods don’t have a way to force a refresh of the Bonjour cache. And as his methods pretty much mimic the Apple Obj-C methods, I’m betting there isn’t an official way to do this with the Bonjour APIs. I’m betting that a restart of the service is likely what is needed.

Am I right in assuming that? Or is there an API that I am somehow not seeing…

First a service advertised to you can be on a different LAN. NO problem.

normally with such a change, you may see some events like services go all away and than come back.

[quote=156582:@Christian Schmitz]First a service advertised to you can be on a different LAN. NO problem.

normally with such a change, you may see some events like services go all away and than come back.[/quote]

Well, true. I suppose my example was slightly misguided. As yeah, you can discover items with different IP addresses on your LAN segment. Here’s a more direct example of what is happening…

Part of what my software does is set up these Bonjour devices and then it assigns these devices to various VLANs on a managed switch. A VLAN is a completely isolated network sub-segment. So when a device is moved from the VLAN that the computer is on (i.e.: the lan) and put in its own VLAN, the device is no longer accessible or discoverable.

However, Bonjour still lists the device and holds that listing for some time.

That’s really more of my issue. Excuse the hastily written and ill-thought first example…