'use strict';

var mdns = require('mdns');

console.log('Listing all raop and airplay services on the network...');

mdns
  .browseThemAll()
  .on('serviceUp', function (service) {
    console.log('--> new service detected: %s.%s.%s', service.type.name, service.type.protocol, service.networkInterface);

    if (!~['raop', 'airplay'].indexOf(service.type.name)) return;

    var browser = mdns.createBrowser(mdns[service.type.protocol](service.type.name));

    browser.on('serviceUp', function (service) {
      console.log('-------------------------------------------');
      console.log('%s up:', service.type.name, service);
    });

    browser.start();
  })
  .start();

@@ -663,16 +663,207 @@
  %7D)%0A  .start();%0A
+%0A// mdns throws when an unexpected protocol is detected - this is dirty but unfortunately required:%0Aprocess.on('uncaughtException', function (err) %7B%0A  console.log('ERROR:', err.message);%0A%7D);%0A

Make the example client more resilient