I have been facing a problem of how to kill a process running on some port. After some digging out on net i found out.
Here is a command line code (sort of shell script)
lsof | grep IPv | grep 3001 | awk '{print $2}' | xargs -l -i kill -9 {}
It did work for me :).