[erlang-questions] Counters for open sockets )

Gleb Peregud gleber.p@REDACTED
Tue Dec 21 11:51:59 CET 2010


Take a look at inet:i() function, at unexported inet:tcp_sockets() [1]
and at port_list/1 function few lines below for working code of
approach pointed out by Kenneth

https://github.com/erlang/otp/blob/dev/lib/kernel/src/inet.erl#L1223

On Tue, Dec 21, 2010 at 10:43, Kenneth Lundin <kenneth.lundin@REDACTED> wrote:
> 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
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list