How to find process using TCP port?

故事扮演 提交于 2020-01-30 08:17:50

问题


After starting a http a couple of times I get this error like an instance of Go has not stopped!?

listen tcp :9000: bind: address already in use

I have experienced something like this with nodejs too but I was able to kill the process.. Unfortunately it seems like I can't find the process id and kill it..

How to "free" the tcp port?


回答1:


If you are on unix like system you can use netstat to find out which process is listening on a port:

sudo netstat -nlp | grep 9000

Turns out the -p option is not available on OS X. If you are using OS X you can do this:

lsof -n -i4TCP:$PORT | grep LISTEN

Who is listening on a given TCP port on Mac OS X?



来源:https://stackoverflow.com/questions/29636472/how-to-find-process-using-tcp-port

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!