joyent/node — Issue #2324: Windows and Linux socket connection timeouts differ
Author: perfectapi
Created: 2011-12-13 19:13:49+00:00
State: open

On Windows, a Node.js client socket *connection timeout* takes about 20 seconds, and on Ubuntu Linux it takes about 190 seconds - an order of magnitude difference. They should be the same, or at least closer (or configurable).

(I discovered this while working with the Amazon Web Service APIs, which gave occasional timeout errors in my local Windows machine but were working consistently from my EC2 Linux instance).

The following code demonstrates the timeout behavior. Run on Windows vs Linux to see the difference (port 993 has no endpoint, so connection times out):
```javascript
var http=require('http');

console.log('start time = ' + new Date());

var request=http.request( {
"port": 993,
"host": "ec2.us-east-1.amazonaws.com" }, function(req) {

console.log('never reach here');
});

request.on('error', function(e) {
console.log('problem with request: ' + e.message);

console.log('error time = ' + new Date());
});
```

In Windows, I get this result:
```
start time = Tue Dec 13 2011 13:03:03 GMT-0600 (Central Standard Time)
problem with request: connect Unknown system errno 10060
error time = Tue Dec 13 2011 13:03:24 GMT-0600 (Central Standard Time)
```

...and under Linux (Ubuntu) I get this result:
```
start time = Tue Dec 13 2011 19:02:05 GMT+0000 (UTC)
problem with request: ETIMEDOUT, Connection timed out
error time = Tue Dec 13 2011 19:05:14 GMT+0000 (UTC)

```