Joel Reymont:
I think within Erlang nodes use a keep alive message to make sure they have not been split off. Quite often, though, you cannot detect if the foreign process exists.
To check whether a _node_ is still running and connected, monitor_node can be used; from http://www.erlang.org/download/erlang-book-part1.pdf page 98:
"If no connection exists, and monitor_node/2 is called, the system will try to setup a connection and deliver a nodedown message if the connection fails."
To check whether a _process_ is still alive, linking to it and checking for the corresponding EXIT message is the way to go.
Dirk Gerrits:
I'm not sure if it matters if a node is dead or just split off.
Erlang doesn't make the distinction, does it?
From the same page:
"The BIF [=built-in function] monitor_node(Node, Flag) can be used to monitor nodes. An Erlang process evaluating the expression monitor_node(Node, true) will be notified with a {nodedown, Node} message if Node fails or if the network connection to Node fails. Unfortunately it is not possible to differentiate between node failures and network failures."
By the way, my experience with Erlang is mostly in trying to develop a Gnutella client a few years ago. To the reasonable nice original Gnutella protocol, many ill-specified ad-hoc extensions were added by the existing clients. Implementing these extensions, which is necessary in order to play well with the other clients, became less and less interesting, so I never finished it. Although I still find Erlang interesting, these days I'm more interested in Common Lisp.
- Willem