1、netstat查看端口信息
netstat -Aan|grep 6666
终端输出
f10005000037cbb0 tcp4 0 0 172.17.252.214.501 172.17.252.8.6666 ESTABLISHED
f1000500002bc3b0 tcp4 0 0 172.17.252.214.508 172.17.252.5.6666 ESTABLISHED
f10005000bb70bb0 tcp4 0 0 172.17.252.214.525 172.17.252.8.6666 ESTABLISHED
2、如果是TCP连接,则使用:
rmsock f10005000037cbb0 tcpcb
如果是UDP连接,则使用:
rmsock f10005000037cbb0 inpcb
输出结果:
The socket 0x37c808 is being held by proccess 11796492 (flow).
3、根据PID查询详细信息
ps -ef|grep 11796492
cd /proc; for i in *; do echo ------ process $i ---------; pfiles $i | grep -i "port: 3380"; done
find ./* -name '*.xml'|xargs grep 'left-equip-name'
grep -H -R "struts.devMode" ./ | cut -d: -f1
a端:nc -ul 500(500为测试的端口)
b端:nc -u x.x.x.x 500(x.x.x.x为测试服务器地址)
正常情况下在b端输入字符串可以在a端接受到。