Is there a Linux library that will enable me to tell what IP sockets are owned by what processes? I guess I\'m looking for the programmatic equivalent of lsof -i
lsof -i
You can read them from proc filesystem. The 'files' you probably want to look at are found in /proc//net (namely tcp, udp, unix)
/proc//net
Here's some examples on using the proc filesystem