遇到端口被占用怎么办? Identify and stop the process that's listening on port 9201 or configure this application to listen on another port.
Identify and stop the process that’s listening on port 9201 or configure this application to listen on another port.)
显示协议统计信息和当前TCP/IP网络连接
可以使用netstat命令
如我们想查看所有连接和端口以及每个连接关联的进程号,则可使用如下命令:
netstat -ano
如我们想查看指定端口的信息,则可使用findstr查询:
netstat -ano | findstr "9200"
得到进程号PID后可以通过进程号查询进程关联的程序名称:
tasklist |findstr "20380"
这样就可以通过任务管理器找到应用并结束,然后解除端口占用啦。
如果任务管理器打不开怎么办? 别急:
taskkill /PID 9200 -f 或则 -t
通过taskkill 命令,可以结束指定进程。
有同学要问了,-f 和 -t 有什么区别吗?当然有啦
-f 表示强制关闭
-t 关闭进程的时候会判断是否存在与该进程有关的子项(母项)进程,存在则不关闭,不存在则关闭
使用 taskkill /? 可以查看更多细节: