Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Does anyone know why this script takes >2s to receive the `error` event on Windows? On MacOS it's essentially instant…
$ time node slow-windows-error.js
Error: connect ECONNREFUSED 127.0.0.1:4
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 4
}
real 0m0.093s
user 0m0.045s
sys 0m0.024s
$ time node slow-windows-error.js
Error: connect ECONNREFUSED 127.0.0.1:4
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 4
}
real 0m2.345s
user 0m0.000s
sys 0m0.046s
const net = require('net');
net.connect({ host: '127.0.0.1', port: 4 }).on('error', console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.