Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes Node.js still support UDP broadcasting?
    text
    copied!<p>I called <code>dgram.setBroadcast(flag)</code> and it returned a <em>not yet implemented</em> error on Node.js version v0.6.3.</p> <p>Does Node.js still support UDP broadcasting? </p> <p><em>Edit: I found <a href="http://groups.google.com/group/nodejs/browse_thread/thread/c294ead91fde78e2?pli=1" rel="nofollow">some discussions</a> said that broadcast was removed in 0.5.x and probably be back in the future.</em></p> <p>still <strong>not</strong> yet implemented in <strong>v0.6.6</strong></p> <p>I tried 0.6.10 in windows 7 x64, the multicast did not work yet.</p> <pre><code>var dgram = require('dgram'); var PACKET_LEN = 64; var message = new Buffer(PACKET_LEN); var client = dgram.createSocket("udp4"); client.setMulticastTTL(128); //dgram.addMembership(multicastAddress, [multicastInterface]) client.addMembership('234.18.128.10', "172.18.128.64") ; // dgram.send(buf, offset, length, port, address, [callback]) client.send(message, 0, PACKET_LEN, 7000, "234.18.128.10"); client.close(); I got an "Error: addMembership EADDRNOTAVAIL". </code></pre> <p>after ref here: <strong>https://github.com/joyent/node/blob/master/test/simple/test-dgram-multicast-multi-process.js</strong> , I finally make multicast work on my windows pc. <br /> node ver=0.6.19</p> <pre><code>var dgram = require('dgram'); var message = new Buffer('this is my message'); var client = dgram.createSocket("udp4"); client.bind(); client.setBroadcast(true) client.setMulticastTTL(128); client.send(message, 0, message.length, 5007, "224.1.1.1"); client.close(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload