title: node net socket connection timeout
body: <p>I noticed, that my node server's net.createConnection() has a very long timeout before firing an error on some occasions (seems to be a particular problem with ports...)</p>
  
  <p>i tried to connect to somedomain:9000  (listening, connecting and working as expected)
  and to somedomain:1234 (same domain, different port, waiting around 2 minutes until "connect ETIMEDOUT")</p>
  
  <p>When i connect to non-existent domains, i get an error right away, but not if i connect to unreachable ports on reachable hosts.
  i need to determine if a machine is reachable in &lt;1sec..</p>
  
  <p>how do i handle this? Must be some way to notice an unreachable port in under 2minutes?
  at least some kind of timeout that just sets the address as unreachable after a set amout of time?</p>
  
  <p>Thanks</p>
  
  <p>UPDATE: current Connection code:</p>
  
  <pre><code>this.openConnection = function() {
      try {
          console.log("[INFO] connecting to " + device.ip + ":" + device.port);
          device.clientSocket = new net.createConnection(this.port,this.ip)
              .on('connect', device.connected)
              .on('data', device.inputReceived)
              .on('error', function(err) {
  
                  if (err.code == "ENOTFOUND") {
                      console.log("[ERROR] No device found at this address!");
                      device.clientSocket.destroy();
                      return;
                  }
  
                  if (err.code == "ECONNREFUSED") {
                      console.log("[ERROR] Connection refused! Please check the IP.");
                      device.clientSocket.destroy();
                      return;
                  }
  
  
                  console.log("[CONNECTION] Unexpected error! " + err.message + "     RESTARTING SERVER");
  
  
                  process.exit(1);
  
              })
              .on('disconnect', function() {
                  console.log("[CONNECTION] disconnected!");
              });
      } catch(err) {
          console.log("[CONNECTION] connection failed! " + err);
      }
  };
  </code></pre>