Skip to content

Instantly share code, notes, and snippets.

@seriousManual
Last active December 17, 2015 20:29
Show Gist options
  • Save seriousManual/5668274 to your computer and use it in GitHub Desktop.
Save seriousManual/5668274 to your computer and use it in GitHub Desktop.
minimal example that shows that the process dies when someone tries to send a udp package in an cluster environment
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++) {
cluster.fork();
}
} else {
http.createServer(function(req, res) {
var message = new Buffer('test');
socket.send(message, 0, message.length, 123, 'xxx');
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
}
@seriousManual
Copy link
Author

actually it seems to work under linux (tested with node v0.8.2) but not under Windows 7 x64 (node v0.10.0)

@seriousManual
Copy link
Author

tested versions:

works on:
Linux, node v0.8.2
Linux, node v0.10.8

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

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