
Untitled
By: a guest on
Jun 10th, 2012 | syntax:
None | size: 0.66 KB | hits: 84 | expires: Never
How to handle the nodejs EMFILE exception without modifying ulimit?
stream = net.createConnection(port, host);
stream.addListener('connect', function() {
return stream.write(request);
});
stream.addListener('data', function(data) {
return console.log(data);
});
stream.addListener('end', function() {
stream.end();
return callback();
});
stream.addListener('timeout', function() {
stream.destroy();
console.log("timeout");
return callback();
});
stream.addListener('error', function(e) {
console.log("this never gets called");
return
});
process.on('uncaughtException', function(err) {
console.log(err);
});