Assume you found an established TCP session with “lsof” or “netstat” and the port is <PORTNUMBER>

How to find the process ID for this connection ?

pfiles `ls /proc` | ggrep -A 10 -B 64  <PORTNUMBER>

With the command above you should see 10 lines above the end a line starting with “peername” and the given <PORTNUMBER>. Several lines above ( hopefully not more than 64 ) one can find the process ID.