Erlang - ports



Returns a list of all ports on the local node.

Syntax

ports()

Parameters

  • None

Return Value

Returns a list of all ports on the local node.

For example

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~w~n",[erlang:ports()]).

Output

When we run the above program we will get the following result. Depending on the system, the output will differ.

[#Port<0.0>,#Port<0.49>,#Port<0.383>,#Port<0.392>]
erlang_bifs.htm
Advertisements