Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devices not responding in time for Browse() #75

Open
chinenual opened this issue Sep 6, 2020 · 3 comments
Open

Devices not responding in time for Browse() #75

chinenual opened this issue Sep 6, 2020 · 3 comments

Comments

@chinenual
Copy link

I'm trying to adapt the client example to my code and am finding that some of the devices I am browsing for do not always respond to the browse. (I'm testing with two devices that both identify as _osc._udp but even when both are up and running, grandcat/zeroconf Browse() sometimes only sees one of them).

My initial thought was to lengthen the timeout of the context to give the devices more time to respond, but that doesn't seem to help. In fact it seems that if a response is not received almost immediately after the Browse() query, it won't ever be received (I've tried increasing browse time up to 30seconds).

Thinking that it might be that the devices are sometimes slow to "wake up", I tried running two back to back browses - a short one to get their attention, and then a longer one to pick up the full set of responses. That also doesn't seem to help. In fact, sometimes the short 3second browse picks up both devices, but then the following longer 15second browse picks up only one of them.

My application can't "know" how many devices it might find, so I can't just keep browsing until I find "n" devices; I need to find some way to make the query and have reasonable confidence that I've found all the available devices.

I'm running a Bonjour browser (Discovery on macos) and it displays the devices practically in real time - as devices come online they get displayed as the go offline they disappear from its list -- unfortunately it's not open sourced so I can't see exactly how it's working internally.

Can anyone advise on best practice on the most reliable way to ensure a Browse() gets accurate response?

@chinenual
Copy link
Author

FWIW, I've found a workaround that seems to work often enough -- I run back to back 3-second browses and just accumulate all unique responses. Each browse may only get a subset of the available device, but when I run it 5 times, at least one of the 5 browses picks up each device.

It's a hack. But its the best I've been able to manage so far...

@DanielHoffmann
Copy link

I am running into this as well, but only in windows. On macos it doesn't seem to happen.

Is the lib relying on OS-level implementation of zeroconf on systems that support it?

@chinenual
Copy link
Author

@DanielHoffmann - that matches my experience. the library works pretty well on MacOS, but is unreliable on Win10. I've tried with and without Apple DLL's installed and cant seem to find a combo that works well on Windows. Would love to know if others are having better success and if so, how -- would like to be able to document some things that my users can do to make bonjour/zeroconf work more reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants