普通linux机器下可以用netstat -anp | grep pid即可。
solaris下则不同,可以借助pfiles工具,pfiles $pid | grep sock
pfiles 26640 | grep sock sockname: AF_INET 10.0.2.91 port: 58731 sockname: AF_INET 0.0.0.0 port: 28491 sockname: AF_INET 10.0.2.91 port: 58732 sockname: AF_INET 10.0.2.91 port: 58733 sockname: AF_INET 10.0.2.91 port: 58734 sockname: AF_INET 10.0.2.91 port: 58735 sockname: AF_INET 10.0.2.91 port: 58730 sockname: AF_INET 10.0.2.91 port: 58736 sockname: AF_INET 10.0.2.91 port: 58737 sockname: AF_INET 10.0.2.91 port: 58738 sockname: AF_INET 10.0.2.91 port: 58739 sockname: AF_INET 10.0.2.91 port: 58740 sockname: AF_INET 10.0.2.91 port: 58741 sockname: AF_INET 10.0.2.91 port: 58742 sockname: AF_INET 10.0.2.91 port: 58743 sockname: AF_INET 10.0.2.91 port: 58744 sockname: AF_INET 10.0.2.91 port: 58745 sockname: AF_INET 10.0.2.91 port: 58746 sockname: AF_INET 10.0.2.91 port: 58747 sockname: AF_INET 10.0.2.91 port: 58748 sockname: AF_INET 10.0.2.91 port: 58749 sockname: AF_INET 0.0.0.0 port: 6166 sockname: AF_INET 0.0.0.0 port: 54266 sockname: AF_UNIX sockname: AF_INET 10.0.2.91 port: 38554 sockname: AF_INET 10.0.2.91 port: 61500 sockname: AF_INET 10.0.2.91 port: 61501 sockname: AF_INET 10.0.2.91 port: 61502 sockname: AF_INET 10.0.2.91 port: 61503 sockname: AF_INET 10.0.2.91 port: 61499