How to find the active TCP and PIDs corresponding to them in Linux programming?

view full story

http://www.linuxquestions.org – Hi all, I am programming on Linux middleware so I need to get a list of all active TCP connections. Is there any API to get such information? I know I can find the connections in /proc/net/tcp, but how to find the PIDs corresponding to the connections? Apparently ps or netstat command is not an option since it is a middleware. Any help will be appreciated! Cheers Tete (HowTos)