Socket
Socket
Sign inDemoInstall

mdns-discovery

Package Overview
Dependencies
3
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdns-discovery


Version published
Maintainers
1
Created

Readme

Source

###mnds Multicast DNS

NPM version License

####Some Examples:

Find all Amazon Fire TV devices on the local network:

var Mdns = require('mdns-discovery');

var mdns = new Mdns({ timeout: 5, name: '_amzn-wplay._tcp.local', find: 'amzn.dmgr:'});
mdns.run (function(res) {
    res.forEach(enry) {
       console.log(entry);
    }
});

List all mdns questions and answers for 10 seconds:

var Mdns = require('mdns-discovery');

var mdns = new Mdns({ timeout: 10 });
mdns.on('packet', function (packets, rinfo) {
    if (packets.answers) packets.answers.forEach(function(packet, i) {
        console.log(`A: ${rinfo.address} - packet[${i}]=${packet.name}, type=${packet.type}, class=${packet.class}, ttl=${packet.ttl}}`);
    });
    if (packets.questions) packets.questions.forEach(function(packet, i) {
        console.log(`Q: ${rinfo.address} - packet[${i}]=${packet.name}, type=${packet.type}, class=${packet.class}, ttl=${packet.ttl}}`);
    });
});
mdns.run ();

Presence:

var mdns = require('mdns-discovery')();

mdns.onIP('192.168.1.31', function (packet, rinfo) {
    if (packet.answers.length) {
        console.log(rinfo.address + ' is present');
    }
}).run ();

Keywords

FAQs

Last updated on 06 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc