Comments (6)
To recap: I'm trying to fix behavior in the current library that causes a LookupType() to not see some services that have already registered themselves with mDNS prior to my application startup. I've observed another application that appears to solve this by sending out a _services._dns-sd._udp query at startup - and gets answers for everything on the network.
.... actually I think my proposed solution may not be sufficient (see below for how it behaves):
I am using wireshark to try to understand how a general bonjour browser works (Discovery on macos). I see it send out a QU query for _services._dns-sd._udp.local and gets Answers for everything on the network.
I've made a local copy of the dnssd module with the proposed fix:
func LookupTypeUnicast(ctx context.Context, service string, add AddServiceFunc, rmv RmvServiceFunc) (err error) {
conn, err := newMDNSConn()
if err != nil {
return err
}
defer conn.close()
return lookupType(ctx, service, conn, add, rmv, true)
}
func lookupType(ctx context.Context, service string, conn MDNSConn, add AddServiceFunc, rmv RmvServiceFunc, unicast bool) (err error) {
...
if unicast {
setQuestionUnicast(&m.Question[0])
}
and call it like this from my application:
serviceType := "_services._dns-sd._udp.local."
logger.Infof("ZEROCONF: serviceDiscovery %s\n", serviceType)
if err = dnssd.LookupTypeUnicast(ctx, serviceType, addFn, rmvFn); err != nil {
if strings.Contains(err.Error(), "context deadline exceeded") {
logger.Debugf("ZEROCONF: ListenFor %s %v\n", serviceType, err)
} else {
logger.Errorf("ZEROCONF: ListenFor %s %v\n", serviceType, err)
}
return
}
I can see the query via wireshark and it looks identical to the one I see from Discovery -- however mine has no answers. Is there something else I need to do ?
from dnssd.
I have created a pull request that implements unicast queries. It solves my "missing answer at app startup" bug. (despite my previous comment suggesting that it was not sufficient, I've been testing since and it does appear to solve the problem).
from dnssd.
Thanks for your effort. I've made some significant changes to the library in the refactoring
branch. Your issue might already be fixed in that branch.
from dnssd.
I peeked at the refactoring branch and don't see anything similar.
FWIW: I've had to change my forked library to be based on the released v1.1.1 tag rather than master. When I run with master, my application chews up 100% CPU continuously while browsing. I've not been able to profile the library to determine why. v1.1.1 does not have this problem.
After testing this for several days, I am no longer sure that this Unicast browse really solves my problem. Even with the unicast query, I am seeing frequent cases where a service started before my application is not seen by the query until that service is restarted.
from dnssd.
I've experienced that unicast responses are never received #15. That's why the library do not use them – see probe.go
I was not able to figure out why this happens. Any ideas?
from dnssd.
I just tried commenting out the SetQuestionUnicast() in my fork -- unfortunately it doesn't seem to improve things.
I spent a considerable time staring at Wireshark logs trying to understand what makes my app using dnssd different than, for example, the Discovery bonjour browser application in the mac store. Other than the unicast difference I could not spot a difference. I really don't know how to diagnose this any further.
What's weird is that for my application, I browse for two different service types. One always works. The other rarely works. Both work 100% reliably in the Discovery app.
_osc._udp.local.
reliably responds immediately (the app is touchosc running on two different ios devices).
The other is a JUCE-based VST (_synergia._tcp.local.
) running on the localhost which rarely responds unless I restart it after I've started my browse. I've reviewed the library that app is using (https://github.com/Anthony-Nicholls/jucey_bonjour); it seems to be directly using Apple's SDK so I have no reason to suspect it's doing something wrong...
I'm open to any and all ideas of how to debug/diagnose this!
from dnssd.
Related Issues (20)
- Rediscovery services and mdns HOT 5
- Question: Service on same IP (cmd/register) is not found by cmd/browse HOT 4
- Fix IP address of a service is published on all network interfaces
- Requested unicast responses are never received
- TXT record updates are not published on all network interfaces
- Lookup services will fail to list ips if the service name contains more than one dot HOT 7
- Publish service on loopback network interface
- panic (sigsegv) in dnssd.probeAtInterface() HOT 2
- by default listens on port 5353 HOT 3
- Question: Refactoring branch HOT 3
- G601: Implicit memory aliasing in for loop. (gosec) HOT 2
- Browse in refactoring branch is broken for windows HOT 3
- How to get hostname and port from a browse? HOT 2
- mdnsConn.readInto() high cpu usage HOT 1
- Publish service on provided interfaces only HOT 3
- Panic when request interfaces are nil HOT 6
- #35 fix code not int tag v1.2.3 HOT 1
- Trying to publish A record HOT 3
- Browse example only works with full service strings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dnssd.