On Wed, Feb 8, 2012 at 05:14, 王 逍 <[email protected]> wrote: > var cluster = require('cluster'); > var http = require('http'); > var net = require('net'); > var util = require('util'); > > if (cluster.isMaster) { > // Fork workers. > for (var i = 0; i < 2; i++) { > cluster.fork(); > } > > cluster.on('death', function(worker) { > console.log('worker ' + worker.pid + ' died'); > }); > } else { > server = net.createServer(function(c) { > > }).listen(8080); > server.on('error', function(e) { > console.log("local server connection error: %s", e); > }) > server.on('listening', function() { > console.log("server listened on: " + > util.inspect(this.address())); > }) > } > > when first executed, outputs: > server listened on: { port: 8080, family: 2, address: '0.0.0.0' } > server listened on: { port: 8080, family: 2, address: '0.0.0.0' } > > but in another terminals(another process, keep the first alive), > second executed, outputs: > > server listened on: { port: 57093, family: 2, address: '0.0.0.0' } > server listened on: { port: 57093, family: 2, address: '0.0.0.0' } > > 57093 is a random port and change when restart process, and it's a > really work server on the port, is it expected? > > I think the second process should get the EADDRINUSE error.
Right. Yes, that's a bug. Can you open an issue? -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
