<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Khitai, <br>
<div><br>
</div>
<div>net_kernel:start is looking at the init value of the EPMD port
(the one specified when erlang was started), so changing the
environment variable in Erlang like this doesn't have any effect.
I agree that it would probably be more intuitive if it worked as
you describe, so please submit a feature request to <a
href="http://bugs.erlang.org" target="_blank">bugs.erlang.org</a>
(or if you have found any documentation saying that it should work
as you say, please submit it as a bug and point to the
documentation), and we'll look into it as soon as we get time to
do so. <br>
<br>
If you want to contribute with a change for this, which you are
very welcome to do, please look at the code in
lib/kernel/src/erl_epmd.erl. Make sure to think it through though,
for example by handling the case when the port environment
variable is changed when the distribution is already started. :)<br>
</div>
<div><br>
</div>
<div>Best Regards, <br>
</div>
Zandra<br>
<br>
<br>
<div class="moz-cite-prefix">On 03/11/2016 05:48 AM, Khitai Pang
wrote:<br>
</div>
<blockquote
cite="mid:BLU436-SMTP199DD6D04C3CD258674AC4BFCB50@phx.gbl"
type="cite">Hi,
<br>
<br>
I have the following code:
<br>
<br>
os:putenv("ERL_EPMD_ADDRESS", inet_parse:ntoa(IP)),
<br>
os:putenv("ERL_EPMD_PORT", integer_to_list(5555)),
<br>
os:cmd("epmd -daemon"),
<br>
net_kernel:start([bob, longnames]),
<br>
<br>
<br>
The ERL_EPMD_ADDRESS and ERL_EPMD_PORT environment variables are
used by os:cmd("epmd -daemon") but net_kernel:start/1 fails:
<br>
<br>
Protocol: "inet_tcp": register/listen error: econnrefused
<br>
<br>
Apparently it still tries to connect to 4369, where no process is
listening.
<br>
<br>
If I start erl by "ERL_EPMD_PORT=5555 erl", net_kernel:start/1 in
the above code works fine.
<br>
<br>
So I have come to the conclusion that environment variables set by
os:putenv/2 are not honored by net_kernel:start/1. Am I right?
If yes, 1) is this a bug? 2) for a Erlang/OTP release, how to
automatically set global environment variables for erl?
<br>
<br>
<br>
Thanks
<br>
Khitai
<br>
_______________________________________________
<br>
erlang-questions mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
<br>
<br>
</blockquote>
<br>
</body>
</html>