After using Mosh, I noticed that UDP ports held by
mosh-server were still in use after all processes exited.
netstat -ln, it shows that these ports are in use:
Active Internet connections Proto Recv-Q Send-Q Local Address Foreign Address (state) udp4 0 0 10.0.106.61.60002 *.* udp4 0 0 10.0.106.61.61006 *.*
Since this is OS X, the
netstat -p flag is not supported, so I cannot find the PID of the process, as https://stackoverflow.com/a/3855359 points out. Instead, I run
sudo lsof -i :61006, which returns nothing.
Okay... perhaps I can list all open files with numeric ports and hostnames and grep through it?
sudo lsof -i -n -P | grep 61006 ...Nope, nothing again.
Obviously these ports do get cleaned up on reboot... But the challenge here is to diagnose and free them up without a reboot.
Any ideas? 🤔