A small Python library that binds to an ephemeral port, forces it into the TIME_WAIT state, and then unbinds, making the port reserved for use by the caller without interference. Current version 1.1.4, maintenance mode with no active development.
pip install ephemeral-port-reserveVerified import paths — ran on the pinned version, not inferred.
Reserve an ephemeral port using the reserve() function. Port is automatically released on process exit.
Ensure your process holds the reservation for the duration needed. Do not rely on cross-process persistence.
Handle exceptions from reserve() and implement retry logic or fallback mechanisms.
If you need more robust port reservation, consider using low-level socket APIs or platform-specific solutions.
Run 'pip install ephemeral-port-reserve' (note hyphens) and import with underscores: 'from ephemeral_port_reserve import reserve'.
The library avoids this by using time_wait state, but if it occurs, wait for the TIME_WAIT to expire (typically 2 * MSL) or use a different port. Retry reservation.
No dependency data recorded yet.