This is something that I seem to need to do increasingly more often when debugging connection problems in our application. Sadly, I have no access to run lsof (which would give me this information), so I use the following script:
echo "which port?> "
read port
for pid in `ps -ef -o pid | tail +2`
do
foundport=`/usr/proc/bin/pfiles $amp;pid 2>&1 | grep "sockname:" | grep "port: $port$"`
if [ "$foundport" != "" ]
then
echo "proc: $pid, $foundport"
fi
done
This needs to be run as the user that owns the process that you suspect, so it is not fool proof, but it has proved very useful so far!