title: UDP multi broadcast nodejs
body: <p>I'm trying to create a UDP multi broadcast based chat program, the idea being that anyone on the local network can just pop on and start typing and sending messages.</p>
  
  <p>I figure that every client needs two sockets, one to send messages and one to receive messages. </p>
  
  <p>At its simplest, this is what I have now:</p>
  
  <pre><code>"using strict";
  
  const multicast_addr = "224.1.1.1",
        bin_addr = "0.0.0.0",
        port = 6811;
  
  var udp = require("dgram");
  
  var listener = udp.createSocket("udp4"),
      sender = udp.createSocket("udp4");
  
  listener.bind(port, multicast_addr, function(){
      listener.addMembership(multicast_addr);
      listener.setBroadcast(true);
  });
  
  listener.on("message", function (b, other) {
      console.log(b.toString().trim());
  });
  
  process.stdin.on("data", function (data){
      sender.send(data, 0, data.length, port, multicast_addr);
  });
  </code></pre>
  
  <p>(Never mind the echo, that's application logic that will be built on top)</p>
  
  <p>This will echo the message back to the person running the code, but I also ran this at the same time on a linux VM on the same machine, OS X, but didn't see the messages being passed at all.</p>
  
  <p>I'm not sure if that means that</p>
  
  <p>1) My code is incorrect</p>
  
  <p>2) VMs have the same networking as their host machine?</p>
  
  <p>3) Code is correct but my home router is blocking multi broadcast packets?</p>