Last active
December 17, 2015 20:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
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
actually it seems to work under linux (tested with node v0.8.2) but not under Windows 7 x64 (node v0.10.0)