<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix"><span class="pl-en"></span>On 7/12/21
3:02 PM, Roberto Ostinelli wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFXp3LKem2BYVLv8f7-G1sSmLFaytBNWvg0We7cy1AN09xjung@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr"><br>
<div>What is the advantage over using a hidden node? Here below
is the output with one@ and two@ in a full cluster, while
three@ has been started with the -hidden option and has been
connected only to one@:</div>
<div><br>
</div>
<div>
<div><font face="monospace">(<b>one</b>@dev.local)1>
nodes().<br>
['<a class="moz-txt-link-abbreviated" href="mailto:two@dev.local">two@dev.local</a>']<br>
(<b>one</b>@dev.local)2> nodes(hidden).<br>
['<a class="moz-txt-link-abbreviated" href="mailto:three@dev.local">three@dev.local</a>']</font></div>
<div><font face="monospace">(<b>one</b>@dev.local)3>
register(shell, self()).<br>
true<br>
</font></div>
<div><br>
</div>
<div><font face="monospace">(<b>two</b>@dev.local)1>
nodes().<br>
['<a class="moz-txt-link-abbreviated" href="mailto:one@dev.local">one@dev.local</a>']<br>
(<b>two</b>@dev.local)2> nodes(hidden).<br>
[]</font><br>
</div>
<div><br>
</div>
<div><font face="monospace">(<b>three</b>@dev.local)1>
{shell, '<a class="moz-txt-link-abbreviated" href="mailto:one@dev.local">one@dev.local</a>'} ! hello.<br>
hello<br>
<br>
(<b>one</b>@dev.local)4> flush().<br>
Shell got hello<br>
ok</font></div>
</div>
<div><br>
</div>
<br>
</div>
</blockquote>
Hi Roberto,<br>
<br>
It is best if you have the kernel app 'dist_auto_connect' setting
set to 'never' if you want to ensure each node connection is created
programmatically (to avoid unintended node connections due to
messages). The function net_kernel:connect_node/1 is creating a
visible node connection, ensuring that your connection makes your
node part of the fully connected set of visible nodes. If you used
net_kernel:hidden_connect_node/1 a hidden node connection would be
created and you will not get any additional node connections from
that function call. However, net_kernel:hidden_connect_node/1
remains undocumented so it isn't clearly part of the public
interface. CloudI (<a class="moz-txt-link-freetext" href="https://cloudi.org">https://cloudi.org</a>) uses it and it is the
preferred function for connecting to an Erlang node from a script,
so I would like to think the function isn't disappearing in the
future.<br>
<br>
Best Regards,<br>
Michael<br>
</body>
</html>