Is there a way to get a list of all open sockets ( socket address or socket descriptor ) in Linux using C in user-space or kernel?
Thank you
Open and read the following:
/proc/net/tcp - a list of open TCP sockets
/proc/net/udp - a list of open UDP sockets
/proc/net/raw - a list all the "raw" sockets
These are like "regular" files that you open and read with a filehandle and will give you all the information you could possibly need about each socket.