I'm trying to implement code that enumerate all existing TCP connections per process (similar to
I prefer to implement it myself and not to rely on
In order to do that, I'm parsing data from
I saw that a number of TCP connections are listed under
/proc/<PID>/net/tcp but not listed by
netstat -lptn command.
For example I see that
/proc/2/net/tcp have several TCP connections (tried on Ubuntu 16).
As I understand,
/proc/1/net/tcp is related to the
/sbin/init process which should not have any TCP connection.
/proc/2/net/tcp is related to
kthreadd which also should not have any TCP connection.