ephemeral port
A temporary port number picked automatically by the operating system from a reserved range.
In more detail
Asking to listen on port 0 means give me any free port, which avoids clashes when tests run in parallel. Outgoing connections also use ephemeral ports on the client side.
Related terms
- port — A number from 1 to 65535 that picks out one service on a machine, such as 22 for SSH or 80 for plain web traffic.
- server.listen() — The method that starts a Node.js server accepting connections on a port; it emits listening once it is ready.
Taught in
- Native HTTP Server: Request & Response Lifecycles — Node.js Internals & Backend Services
- Routing & Middleware: Path Parsing & Async Context — Node.js Internals & Backend Services
- Native HTTP/2 Protocols: Multiplexed Streams & Push — Node.js Internals & Backend Services
- Native WebSockets: Bidirectional Real-Time Streams — Node.js Internals & Backend Services
- Production Hardening: Graceful Shutdown & Docker — Node.js Internals & Backend Services