13 ms·
You can listen on an anonymous port. It's similar to how the kernel allocates a port for outgoing connections. It's very useful if you want to listen ephemerall
by singron 2y ago
You can listen on an anonymous port. It's similar to how the kernel allocates a port for outgoing connections. It's very useful if you want to listen ephemerally, especially in tests. The downside is that you need your server to report which port it's actually listening on, and if it restarts, it will get a different port.
- Joker_vD 2y agoWell, you need to monitor the process for going down anyway, and ss -lntp | grep 'pid=<SERVER'S PID>' | awk '{ print $4 }' takes care of servers who don't report the port they're actually listening on.