[erlang-questions] TCP open port count

Danil Zagoskin z@REDACTED
Fri Feb 13 17:17:47 CET 2015


A slow but working way could be iterating over all ports searching for tcp
ones:
length([P || P <- erlang:ports(), erlang:port_info(P, name) ==
{name,"tcp_inet"}]).

And this is what inet:i(tcp) actually does.

On Fri, Feb 13, 2015 at 7:03 PM, Roberto Ostinelli <roberto@REDACTED>
wrote:

> Dear list,
> Is there a system command that can easily tell me how many TCP ports are
> open on a system?
>
> erlang:system_info(port_count)
>
> This returns all port, I'd like to know only the TCP ones.
>
> Thank you,
> r.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>


-- 
Danil Zagoskin | z@REDACTED
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150213/00c3901b/attachment.htm>


More information about the erlang-questions mailing list