|
Function for finding Which process is using a port
Hi,
I am trying to find a C library routine/ sys call that would enable me to find which process is using a particular port. For example, lets sasy I want to find out which process(es) is using port# 2000 to send and receive messasges.
I searched online and found that there is a function called lsof that returns values to the shell when called. But how could I do it in a C program, without having to call lsof and write its results into a file, and then scanning it. I am utilizing a TCP connection on ubuntu with gcc 4.2.3
Thanks in advance.
|