[erlang-questions] Counters for open sockets )

Kenneth Lundin kenneth.lundin@REDACTED
Tue Dec 21 10:43:22 CET 2010


Hi,

You can start like this with finding information about all ports.
Every socket corresponds to a port,
and every open file does also correspond to a port.

[erlang:port_info(P)||P <- erlang:ports()].

% this will give you a list of port_info tuples per port like this
(from a new started Erlang shell)
[[{name,"efile"},
  {links,[<0.3.0>]},
  {id,1},
  {connected,<0.3.0>},
  {input,0},
  {output,0}],
 [{name,"efile"},
  {links,[<0.18.0>]},
  {id,89},
  {connected,<0.18.0>},
  {input,0},
  {output,0}],
 [{name,"2/2"},
  {links,[<0.21.0>]},
  {id,363},
  {connected,<0.21.0>},
  {input,0},
  {output,0}],
 [{name,"tty_sl -c -e"},
  {links,[<0.23.0>]},
  {id,372},
  {connected,<0.23.0>},
  {input,107},
  {output,762}]]


/Kenneth , Erlang/OTP Ericssson


On Tue, Dec 21, 2010 at 10:30 AM, Rudolph van Graan
<rvg@REDACTED> wrote:
> Hi,
>
> Are there any built-in mechanisms in Erlang for knowing how many open sockets a VM has (or open files for that matter)?
>
> Thanks
>
> Rudolph


More information about the erlang-questions mailing list