tcp-port-used icon indicating copy to clipboard operation
tcp-port-used copied to clipboard

The library returns wrong status if listener doesn't accept more connection.

Open davutg opened this issue 4 years ago • 1 comments

In the provided sample if the application using 44201 is not accepting more connections, even the application runs inUse become false. It's possible to reproduce by coding or using a small TCP socket server and allowing a single connection. When socket is not bound tcpPortUsed works fine but when listening application stop accepting new connections it thinks socket is not in use. In other words it's checking if a new connection can be made to port but not if the port is in use or not.

var tcpPortUsed = require('tcp-port-used');

tcpPortUsed.check(44201, '127.0.0.1')
.then(function(inUse) {
    console.log('Port 44201 usage: '+inUse);
}, function(err) {
    console.error('Error on check:', err.message);
});

davutg avatar Feb 11 '21 13:02 davutg

I'll look into this . Thank you for the report, I'm grateful!

stdarg avatar Feb 12 '21 18:02 stdarg