This repository has been archived by the owner. It is now read-only.

Sending a UDP packet fails within the Cluster environment on Windows #5587

seriousManual opened this Issue May 29, 2013 · 10 comments


None yet
9 participants

I was trying to send a UDP packet from a application that uses the cluster module. This fails on Windows, on Linux it works fine.

Code to reproduce:

var dgram = require('dgram');
var cluster = require('cluster');
var http = require('http');

var socket = dgram.createSocket('udp4');

if (cluster.isMaster) {
    for (var i = 0; i < 4; i++) {
} else {
    http.createServer(function(req, res) {
        var message = new Buffer('test');

        socket.send(message, 0, message.length, 123, 'xxx');

        res.end('hello world\n');

Tested on:

Linux, node v0.8.2
Linux, node v0.10.8

does not work:
Windows7 x64, node v0.10.0
Windows7 x64, node v0.10.8

Error message:

        throw er; // Unhandled 'error' event
Error: write ENOTSUP - cannot write to IPC channel.
    at errnoException (child_process.js:980:11)
    at (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)

bnoordhuis commented May 29, 2013

It's only implemented on Unices so far, courtesy of a company sponsoring us. Windows support requires some non-trivial changes to libuv.

Thanks for the details, maybe the documentation should be updated on that topic, that would keep me from wasting half a day on the matter. :)


bnoordhuis commented May 29, 2013

I've added a note in 9826b15.

avimar commented Jun 1, 2014

Is this still true? (I don't use windows to check..)
Perhaps it should be made explicit here somewhere:

"Sharing TCP supported in Linux and Windows, UDP supported only in Linux"

AFAIK, yes. Had to switch from node.js to Golang for one of my projects because of this.


rmg commented Sep 4, 2014

#3856 was closed with a fix that would probably help with this. If I'm not mistaken, as of 029cfc1 one can do an explicit .bind({ port: 0, exclusive: true }) on the socket before sending instead of letting .send() do so implicitly, which should bypass the troublesome behaviour on Windows.

cjihrig commented Nov 23, 2014

As @rmg mentioned, this problem can be solved using an exclusive bind. If that's not a satisfactory solution, #8643 will do this automatically for you. Recommend closing this now or once #8643 lands.


sam-github commented Nov 26, 2014

I would recommend not closing unless #8643 lands, its very much open.

avdg commented May 16, 2015

Any need to keep this issue open?


sam-github commented May 22, 2015

I'm OK to close it.

@jasnell jasnell closed this May 26, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.