Skip to content

Perhaps too general matching responses? #21

@pragdave

Description

@pragdave

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"
   ]
 }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions