1、linux
lsof -i:port
netstat  -ltunp


2、Windows
在windows命令行窗口下执行:
C:\>netstat -aon|findstr "端口"
C:\>tasklist|findstr "端口"
什么占用了你的端口。
另外一种方式:
 可以查看win下所有开着的端口是被那个系统程序占用以及程序的pid。
netstat -noab