如何使用TCP端口查找进程? [英] How to find process using TCP port?

查看:66
本文介绍了如何使用TCP端口查找进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多次启动http后,出现此错误,例如Go的实例尚未停止!?

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

我在nodejs上也经历过类似的事情,但是我能够终止该进程..不幸的是,似乎无法找到进程ID并终止它..

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

如何释放" TCP端口?

How to "free" the tcp port?

推荐答案

如果您使用的是类似Unix的系统,则可以使用netstat找出正在侦听端口的进程:

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

结果是-p选项在OS X上不可用.如果您使用的是OS X,则可以执行以下操作:

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

谁在听在Mac OS X上指定了TCP端口?

这篇关于如何使用TCP端口查找进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆