tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Obtaining list of created sockets



That would be an excellent start; I had considered it before, however I thought that netstat only listed listening connections. With lsof, you would only get sockets created with fsocket (those having file descriptors).

I suppose combining the way the two get their information would yield a majority of the sockets created, however I would like to get all internal sockets that may not be listening yet, or never get a file descriptor.


On Mon, Jun 30, 2014 at 8:53 AM, Johnny Billquist <bqt%softjar.se@localhost> wrote:
On 2014-06-30 08:52, Johnny Billquist wrote:
On 2014-06-30 08:29, Will Dignazio wrote:
Hi,

I've dug through the so* code, and haven't found any table or list
dedicated to created sockets. The exception only seems to be fsocreate,
which attaches a file descriptor that could be used to find the assigned
socket.

I'm working on a module where I would like to expose the list of created
sockets as a series of directories containing file descriptors that let
you access the properties of the sockets. This of course requires that
the module be aware of all the created sockets in the system. So,
without modifying the current socket creation process, is there a way to
obtain a list or table of created (not necessarily bound/open/listening)
sockets?

Why not just check how netstat does it?

Or lsof, if you want find potential open file descriptors before they have even been bound...

        Johnny




--
William Dignazio


Home | Main Index | Thread Index | Old Index