title: Network Programming in C for name of running process for established connection
body: <p>I am new to C network programming. I am trying to code a patch for my conky to display something like "netstat -pan --inet". Conky's inbuilt tcp_mon to not include process name. </p>
  
  <p>Initially I did this using netstat and awk but my script got a performance hit using this approach. So I am trying to code it in C directly. The output from netstat looks something like this</p>
  
  <pre><code>Proto Recv-Q Send-Q Local Address           Foreign Address         State           PID/Program name    
  tcp        0      0 0.0.0.0:17500           0.0.0.0:*               LISTEN         1042/dropbox        
  tcp        0      0 192.168.0.1:3333        24.244.4.104:2222     ESTABLISHED    1225/chrome 
  </code></pre>
  
  <p>I am interested in displaying the last column "PID/Program" I look at the sockets library but I did not come across anything regarding the process name or its pid. I am on Archlinux by the way</p>
  
  <p>So my questions are
  1) Am I looking at the right place ? If not, where ?
  2) Is there a better way of doing this ?</p>