Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 10th, 2012  |  syntax: None  |  size: 0.66 KB  |  hits: 84  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to handle the nodejs EMFILE exception without modifying ulimit?
  2. stream = net.createConnection(port, host);
  3.  
  4.   stream.addListener('connect', function() {
  5.     return stream.write(request);
  6.   });
  7.   stream.addListener('data', function(data) {
  8.     return console.log(data);
  9.   });
  10.   stream.addListener('end', function() {
  11.     stream.end();
  12.     return callback();
  13.   });
  14.   stream.addListener('timeout', function() {
  15.     stream.destroy();
  16.     console.log("timeout");
  17.     return callback();
  18.   });
  19.   stream.addListener('error', function(e) {
  20.     console.log("this never gets called");
  21.     return
  22.   });
  23.        
  24. process.on('uncaughtException', function(err) {
  25.   console.log(err);
  26. });