First, I started one shell:
erl -sname e1 -setcookie secretcookie
Then, in another terminal, start the second. They have to have different short
names (the sname
) and the same cookie:
erl -sname e2 -setcookie secretcookie
I made a simple program that listens for a message and responds to it:
accept_data() ->
receive
{From, Result} ->
io:format("Received ~p from ~p.~n", [Result, From]),
accept_data()
end.
Then in the e1
shell, I spawn the process and registered it as a name:
register(ad, spawn(complex3, accept_data, [])).
In the e2
shell, I make a call to that like this:
{ad, e1@bashombp} ! {self(), [{foo, 1}, {bar, 2}, {baz, 3}]}.