http.Server doesn't expose randomly selected port
See original GitHub issueIf you specify port 0
, as serve({ port: 0 })
the library works correctly and automatically selects a port. However, the port is accessible to the process cannot advertise where it is listening on. In some cases it is desirable to start a process on any available port, and then advertise it, be it through the console, or some other transport/file.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (6 by maintainers)
Top Results From Across the Web
server using port 0, can't access to the random port #5102
but when I tried to access to the port with server.listener.addr.port , I had this message: error TS2339: Property 'port' does not exist...
Read more >Expose random port to docker-compose.yml
I can communicate with container within docker-compose file using fixed port for container and exposing them for host machine. server. port=0 ...
Read more >How To Expose or Publish Docker Ports
Docker identifies all ports exposed using the EXPOSE directive and those exposed using the –expose parameter. Then, each exposed port is mapped ...
Read more >How to automatically choose a free port in ASP.NET Core 3.0
For example, to bind to a random http and https port on the loopback (localhost) address, run your application using the following command:...
Read more >Registered Port - an overview
Random port numbers (sometimes called ephemeral port numbers) have values greater than 1024, which are assigned arbitrarily using TCP or UDP when the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@aricart @getspooky You can actually already do this, though it’s somewhat quirky (
.port
andAddr
typing), see https://github.com/denoland/deno/pull/11410#issuecomment-880747416:@iuioiua Thanks. Right, this was resolved in #2311. Now the listening port is available in the option of
onListen
handler.