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

Duplicate Discovery, Including Local #165

Open
WickedDevice opened this issue May 3, 2016 · 1 comment
Open

Duplicate Discovery, Including Local #165

WickedDevice opened this issue May 3, 2016 · 1 comment

Comments

@WickedDevice
Copy link

Hi all,

I finally got through the hoops on getting this working on my Raspberry Pi 3, running Raspbian Jesse. I dug this out of the issues to get it working.

var sequence = [
   mdns.rst.DNSServiceResolve(),
   'DNSServiceGetAddrInfo' in mdns.dns_sd ? 
      mdns.rst.DNSServiceGetAddrInfo() : 
      mdns.rst.getaddrinfo({families:[0]}),
   mdns.rst.makeAddressesUnique()
];
var browser = mdns.createBrowser(mdns.tcp('http'), {resolverSequence: sequence});

I register this event handler:

browser.on('serviceUp', function (service) {
   console.log("service up: ", service);   
});

... and I actually find stuff on my network (like an HP printer). The odd thing, to me, is that I seem to get everything in duplicate. And, to boot, I also see the service that I'm advertising from the same program. Is the library supposed to discover services running locally? Any way to prevent it from doing that? Here's an example of the discoveries on my network:

service up:  { interfaceIndex: 3,
  type: 
   ServiceType {
     name: 'http',
     protocol: 'tcp',
     subtypes: [],
     fullyQualified: true },
  replyDomain: 'local.',
  flags: 2,
  name: 'raspberrypi',
  networkInterface: 'wlan0',
  fullname: 'raspberrypi._http._tcp.local.',
  host: 'raspberrypi.local.',
  port: 3000,
  addresses: [ '192.168.1.78' ] }
service up:  { interfaceIndex: 3,
  type: 
   ServiceType {
     name: 'http',
     protocol: 'tcp',
     subtypes: [],
     fullyQualified: true },
  replyDomain: 'local.',
  flags: 2,
  name: 'raspberrypi',
  networkInterface: 'wlan0',
  fullname: 'raspberrypi._http._tcp.local.',
  host: 'raspberrypi.local.',
  port: 3000,
  addresses: [ '192.168.1.78' ] }
service up:  { interfaceIndex: 3,
  type: 
   ServiceType {
     name: 'http',
     protocol: 'tcp',
     subtypes: [],
     fullyQualified: true },
  replyDomain: 'local.',
  flags: 2,
  name: 'HP LaserJet 200 color M251nw (1341D0)',
  networkInterface: 'wlan0',
  fullname: 'HP\\032LaserJet\\032200\\032color\\032M251nw\\032\\0401341D0\\041._http._tcp.local.',
  host: 'NPI1341D0.local.',
  port: 80,
  addresses: [ '192.168.1.122' ] }
service up:  { interfaceIndex: 3,
  type: 
   ServiceType {
     name: 'http',
     protocol: 'tcp',
     subtypes: [],
     fullyQualified: true },
  replyDomain: 'local.',
  flags: 2,
  name: 'HP LaserJet 200 color M251nw (1341D0)',
  networkInterface: 'wlan0',
  fullname: 'HP\\032LaserJet\\032200\\032color\\032M251nw\\032\\0401341D0\\041._http._tcp.local.',
  host: 'NPI1341D0.local.',
  port: 80,
  addresses: [ '192.168.1.122' ] }

The first two and the next two seem like pure duplicates to me... am I missing something?

@agnat
Copy link
Owner

agnat commented Oct 15, 2016

The odd thing, to me, is that I seem to get everything in duplicate

Yes, that's odd. It most likely is yet another raspbian networking issue. I don't know raspbian first hand so I can't help, I'm afraid. I could rant a bit about the crazy stuff I hear about the raspbian network stack if it helps? It definitely is not normal.

And, to boot, I also see the service that I'm advertising from the same program.

That on the other hand is perfectly normal and by design (of the underlying system service). The name property is unique on the local network... #166 has some code.

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