Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node js 0.10.7: cluster support for udp dgram?

I'm trying to run following node js application as mentioned https://github.com/joyent/node/issues/2194

var util = require("util"),
  dgram = require("dgram"),
  cluster = require('cluster');

var udp = dgram.createSocket("udp4");
var port = 1190;

if (cluster.isMaster) {
  for (i = 0; i < 2; i++) {
    cluster.fork();
  }
} else {
  util.log("starting udp server on port " + port);
  udp.on("error", function (error) {
    util.log("failed to bind to UDP port - " + error)
  });
  udp.bind(port);
}

The app exits immediately with the following output:

23 May 23:22:13 - starting udp server on port 1190
23 May 23:22:13 - starting udp server on port 1190

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write ENOTSUP - cannot write to IPC channel.
    at errnoException (child_process.js:980:11)
    at ChildProcess.target.send (child_process.js:455:16)
    at Worker.send (cluster.js:401:21)
    at sendInternalMessage (cluster.js:394:10)
    at handleResponse (cluster.js:177:5)
    at respond (cluster.js:192:5)
    at Object.messageHandler.queryServer (cluster.js:242:5)
    at handleMessage (cluster.js:197:32)
    at ChildProcess.EventEmitter.emit (events.js:117:20)
    at handleMessage (child_process.js:318:10)

Does anyone know what is going on? When running this without cluster, everything is fine. It seems that cluster does not support udp?

Some specs:

Window 7 x64
node js 0.10.7
like image 931
Sepp Van Rompaey Avatar asked May 23 '13 21:05

Sepp Van Rompaey


1 Answers

It says in the link your provided that support for UDP clustering was added in v0.11.14. It is likely that you simply need to update your version of node.js

like image 63
Nick Ellis Avatar answered Oct 18 '22 20:10

Nick Ellis