[erlang-questions] TCP open port count

Wes James comptekki@REDACTED
Fri Feb 13 17:59:30 CET 2015


Via os:cmd??

{Open_ports_pre, _} = string:to_integer(os:cmd("netstat -a | egrep
'Proto|LISTEN' | wc -l")).

Open_ports = Open_ports_pre-2.

-wes

On Fri, Feb 13, 2015 at 9:03 AM, 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150213/1596b95f/attachment.htm>


More information about the erlang-questions mailing list