Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Well, 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.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: