apaszke / tcp-ping

TCP ping utility for node.js
MIT License
123 stars 27 forks source link

Timeout not being respected #4

Closed Sparticuz closed 7 years ago

Sparticuz commented 7 years ago

Shouldn't this return false pretty much immediately? The timeout is 1ms. Instead it's waiting 21 seconds before returning false.

const tcp = require("tcp-ping");

let opts = {
    address: "good address",
    port: bad port,
    timeout: 1
}

tcp.ping({ address: opts.address, port: opts.port, attempts: 1, timeout: opts.timeout }, function(err, data) {
    let available = data.min !== undefined;
    console.log(available);
});
apaszke commented 7 years ago

It's possible that something has changed in the new Node versions. I haven't been following that recently.

Sparticuz commented 7 years ago

Figured it out. I think it has something to do with me running it in the Ubuntu in Windows bash console. It seems to run properly on Linux proper.