Search code examples
erlangcnode

How to monitor cnodes from erlang nodes


I've been building an application based on the cnode tutorial http://www.erlang.org/doc/tutorial/cnode.html and all is looking fine - my question however is, is there a way to do something similar to nodes() or net_adm:world() to get a list of the cnodes connected?

At the moment I'm not able to see the node using either command.


Solution

  • C nodes are hidden. They are listed by nodes(connected) and nodes(hidden) once they are connected to the node.

    This is on purpose to simplify implementation on the C side. Nodes that are listed in nodes() must implement many features including a global server.

    If you really want your C node to appear in nodes(), you will have to extend the behavior of your node significantly and handle many system messages. Yet this is doable, you can rewrite the erl_interface function erl_publish which eventually calls ei_epmd_r4_publish which, in turn, publishes your node as hidden.