[erlang-questions] detection of hostname
Mon Oct 22 22:41:17 CEST 2012
On Mon, Oct 22, 2012 at 10:07 PM, Dmitry Kolesnikov
> You have two options:
> 1. You are using FQDN for node name and relies on DNS. If you do not have DNS infra then like you notice /etc/hosts will help you on Unix/Linux, on Win an equivalent should exist.
This doesn't help if Erlang uses another method and uses another host
name, does it?
> 2. You are using IP address.
For which network adapter, when we have several? I'd have to add a
My question could be restated in a different way: is there a standard
way of retrieving the host name in such a way as to get an useable
name? Like in which order to query services, and such. If yes, does
Erlang use it? If no, why not?
> On Oct 22, 2012, at 10:53 PM, Vlad Dumitrescu wrote:
>> In erlide we are starting erlang nodes from Java and lately we had
>> (and still have some) trouble with retrieving a host name that works.
>> The latest versions are starting an erlang node with "erl -name foo"
>> and read the hostname used by it. Today I got a report that this
>> method is not reliable either: for a machine called "desktop", erlang
>> may detect it is on a network and use "desktop.domain.com" as
>> hostname. But the DNS might not be able to resolve that name, and it
>> may not be in /etc/hosts either. So even if two erlang nodes can
>> connect to each other using this name, other programs that use other
>> ways to resolve the name can't connect.
>> I've been trying hardcoding "localhost" and "127.0.0.1" but that makes
>> the nodes unreachable from other machines, so one can't reliably do
>> My knowledge about name resolution in networking is poor (just what I
>> discovered while fighting this issue), so I'll ask a dumb question:
>> isn't there a method to get a host name that can be use in all
>> circumstances (when there is one)? That is it should be resolvable by
>> the OS, not something made-up from the machine name and the network
>> Or if anybody has a suggestion for another method for starting an
>> Erlang node that one can later always connect to, I am open for
>> I could keep adding checks (look for /etc/hosts myself, query the DNS,
>> etc), but I can't possibly cover all OSs and all possible network
>> configurations. It feels like this is an operation that should have a
>> standardized implementation...
>> Thanks in advance!
>> best regards,
>> erlang-questions mailing list
More information about the erlang-questions