<p>Just start epmd yourself before start of Erlang nodes </p>
<p>Kenneth/</p>
<p><blockquote type="cite">Den 20 okt 2011 07.20, "Ciprian Dorin Craciun" <<a href="mailto:ciprian.craciun@gmail.com">ciprian.craciun@gmail.com</a>> skrev:<br><br> Hello all!<br>
<br>
I'm using Erlang in a context where I want to "manually" start and<br>
manage the EPMD OS process (for the usage of distributed Erlang<br>
nodes). (By manually I mean as part of an OS related supervisor tree,<br>
but not started by the erl interpreter.)<br>
<br>
Now after searching the Internet and the latest OTP sources, I<br>
haven't found a way to properly do this. This is what I've found:<br>
* you could specify `-no_epmd` as an argument for the `erl`<br>
invocation, which stops `erlexec.c` from executing `epmd`;<br>
* unfortunately specifying `-no_epmd` also stops<br>
`erl_distribution` to start by default `erl_epmd` gen_server process<br>
which is needed by `inet_tcp_dist`;<br>
<br>
A possible workaround I've found is to do the following (which I<br>
think it is actually a bug):<br>
* add `-no_epmd whatever` to `erl` arguments; (it seems that<br>
`erlexec.c` searches for `no_epmd` which sets an internal flag, but<br>
also copies the whole argument to be read by `init:get_argument`);<br>
* doing this (adding `whatever`) makes<br>
`init:get_argument(no_epmd)` return `{ok, [["whatever"]]` which<br>
"fools" `erl_distribution` into thinking that `no_epmd` wasn't set (it<br>
has a case with only the `{ok, [[]]}` and `_`);<br>
<br>
Also I've noticed that `erl_distribution` then uses the<br>
`net_kernel:epmd_module()` fuction to find out the module to start.<br>
There is an argument `-epmd_module` which could allow to change the<br>
default module, but unfortunately there is a bug: it just returns the<br>
string obtained directly from `init:get_argument`, which isn't an<br>
atom, and thus it crashes the interpreter. Shouldn't it use<br>
`list_to_atom`? (I'm almost certainly this is a bug. To check it just<br>
run `erl` and ask for `net_kernel:epmd_module().`, then run `erl<br>
-epmd_module whatever`, and ask again `net_kernel`.)<br>
<br>
Thanks for your feedback,<br>
Ciprian.<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></p>