lsof (list open files) gives the COMMAND, PID (process ID), and USER (user ID) of open Internet sockets when used with -i
option.
$ lsof -i -n
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Python 67982 sunmin 3u IPv4 0xecf272 0t0 TCP *:65432 (LISTEN)