How to get a list of open sockets in Linux using C?

前端 未结 4 1635
名媛妹妹
名媛妹妹 2020-12-15 11:39

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

4条回答
  •  别那么骄傲
    2020-12-15 12:32

    The raw data can be found at /proc/net/tcp, /proc/net/udp, etc. Refer to the header at the first line for a (terse) description.

提交回复
热议问题