1

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.

Martin Kristiansen
  • 9,875
  • 10
  • 51
  • 83

1 Answers1

3

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.

Paul Guyot
  • 6,257
  • 1
  • 20
  • 31
  • this almost answers my question, I do however have a follow up, why does my cnode first appear nodes(hidden) after I've done call to it? – Martin Kristiansen Oct 29 '13 at 06:00
  • 2
    When you make a call to the C node, you connect to it and therefore the node is then listed by `nodes(connected)` and `nodes(hidden)` which is a sublist thereof. `net_adm:names/0` lists both connected and unconnected but visible nodes. – Paul Guyot Oct 29 '13 at 06:51