Kitura icon indicating copy to clipboard operation
Kitura copied to clipboard

Option to listen on next available port

Open djones6 opened this issue 9 years ago • 2 comments

While researching the concept of listening on an ephemeral port, I stumbled across this interesting issue: http://stackoverflow.com/questions/5139808/tcp-simultaneous-open-and-self-connect-prevention

It seems that listening on an ephemeral port is not a great idea.

We might want to enable Kitura to listen on "the next available port starting at X", so that a group of servers could be started without having to determine in advance what port to use. The actual port in use would then be logged, and available programatically via HTTPServer.port.

We might want to allow the user to define a range of values they consider acceptable, eg. listen on (8080 ... 8100).

djones6 avatar Dec 07 '16 15:12 djones6

This follows on from https://github.com/IBM-Swift/Kitura-net/pull/156 which fixes a bug where the reference to the port was not updated if the port number requested was 0 (any ephemeral port).

djones6 avatar Dec 07 '16 15:12 djones6

I can see the rationale for doing this, but has anyone asked for this feature yet?

ianpartridge avatar Dec 08 '16 10:12 ianpartridge