CLOSE_WAIT
means your program is still running, and hasn’t closed the socket (and the kernel is waiting for it to do so). Add -p
to netstat
to get the pid, and then kill it more forcefully (with SIGKILL
if needed). That should get rid of your CLOSE_WAIT
sockets. You can also use ps
to find the pid.
SO_REUSEADDR
is for servers and TIME_WAIT
sockets, so doesn’t apply here.