In linux, netstat command tells us information of active sockets in system.
I understand that netstat uses /proc/net/tcp to acquire the system
netstat
/proc/net/tcp
It gets them from kernel space directly using Netlink which uses the classic sockets API.