http-party / node-portfinder

A simple tool to find an open port or domain socket on the current machine
https://github.com/http-party/node-portfinder
Other
887 stars 95 forks source link

Port in TIME_WAIT state should not be returned #62

Closed arielhad closed 6 years ago

arielhad commented 6 years ago

I used portfinder.getPortPromise({port: startRangePortToUse}) in order to get free port but getPortPromise does not filter out ports stuck in TIME_WAIT status -which mean that the port is not really "free"

eriktrom commented 6 years ago

this issue is legit, the only way to make this work is to echo something through the net.Server.

i did a spike of this, the problem is that interfaces like bluetooth throw really random errors - which is fine, but we'd have to (probably) completely switch to this style of 'is a port open' verification and make a major version bump - I am open to a PR for this, with the caveat that that someone would be around to go through the bugs that may ensue (and this package has a lot of upstream consumers)

closing, but by no means off the table