Erlang: How to send a message to a registered process on another node

It took me ages to find out how to do this — it is such a simple thing that no-one ever seems to mention it. Assuming that you have a process registered to foo:

register(foo, Pid).

you send it a message from the current node by doing:

foo ! "hello".

and you send it a message from another node by doing:

{ foo, node_name@othernode } ! "hello".

3 Responses to “Erlang: How to send a message to a registered process on another node”

  1. thomas lackner Says:

    A lot of examples also use rpc:cast in this instance.

  2. david stevenson Says:

    Hi Chris, playing withy I.Ex. at Changi while waiting fora flight to SL. Nice photos. In Kandy for a month. +61 438870873

  3. fram Says:

    Thanks ! This was very helpful.