Erlang - node



This is used to determine the value of the node on which the process needs to run. Since distributed programming is used to run functions on different nodes, this function comes into good use when wanting to run programs on different machines.

Syntax

node()

Parameters

  • None

Return Value

This returns the name of the local node. nonode@nohost is returned if the node is not distributed.

For example

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

start() ->
   io:fwrite("~p",[node()]).

Output

When we run the above program, we will get the following result.

nonode@nohost
erlang_distributed_programming.htm
Advertisements