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

Perhaps too general matching responses? #21

Open
pragdave opened this issue Oct 2, 2022 · 0 comments
Open

Perhaps too general matching responses? #21

pragdave opened this issue Oct 2, 2022 · 0 comments

Comments

@pragdave
Copy link
Contributor

pragdave commented Oct 2, 2022

I'm not too familiar with mdns, so perhaps this is how it is supposed to work, but...

I have a Node.js service that I'm advertising as trace-appliance._trap-tracer._udp.local.

In my Elixir app, I query for that string.

Tracing the handle_info callbacks, I see messages such as those down below.

The first is a correct response, giving the IP and port of my service.

The others however are responses for the AFP service. They've been selected because the
list of services they contain includes what I'm guessing are all the services advertised by my box.

Looking at the code, the mdns client seems to accept a message if any of the services it contains is a substring of the query.

Am I using it incorrectly?

Dave

==================================================
{:"trace-appliance._trap-tracer._udp.local",
 %Mdns.Client.Device{
   domain: "laptop.lan.local",
   ip: {192, 168, 86, 173},
   payload: %{},
   port: 51516,
   services: ["trace-appliance._trap-tracer._udp.local",
    "_trap-tracer._udp.local"]
 }}
==================================================
{:"trace-appliance._trap-tracer._udp.local",
 %Mdns.Client.Device{
   domain: "laptop.local",
   ip: {192, 168, 86, 173},
   payload: %{},
   port: 7000,
   services: [
     <<192, 56, 0, 4, 64, 0, 0, 8>>,
     "laptop.local",
     <<192, 12, 0, 5, 0, 0, 128, 0, 64>>,
     "laptop._airplay._tcp.local",
     "trace-appliance._trap-tracer._udp.local",
     "_trap-tracer._udp.local"
   ]
 }}
==================================================
{:"trace-appliance._trap-tracer._udp.local",
 %Mdns.Client.Device{
   domain: "laptop.local",
   ip: {192, 168, 86, 173},
   payload: %{},
   port: 7000,
   services: [
     <<192, 66, 0, 4, 64, 0, 0, 8>>,
     "laptop.local",
     <<192, 12, 0, 5, 0, 0, 128, 0, 64>>,
     "F01898668893@laptop._raop._tcp.local", 
     <<192, 56, 0, 4, 64, 0, 0, 8>>,
     "laptop._airplay._tcp.local",
     "trace-appliance._trap-tracer._udp.local",
     "_trap-tracer._udp.local"
   ]
 }}
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

1 participant