[erlang-questions] Problems when running distributed pingpong

Jiansen He jiansenhe@REDACTED
Thu Oct 7 15:03:10 CEST 2010


Thank you so much.  Your trick works.  It is simple and useful!

Jiansen


On Thu, Oct 7, 2010 at 9:17 AM, Raimo Niskanen <
raimo+erlang-questions@REDACTED<raimo%2Berlang-questions@REDACTED>
> wrote:

> Hi.
>
> Regarding name resolution Windows and MacOS X are two rather
> irregular platforms for Erlang. Congratulations.
>
> There are lots of tricks you can do by configuring Erlang's name
> resolution to compensate for environment glitches. See:
>    http://www.erlang.org/doc/apps/erts/inet_cfg.html
> What often happens when you take this path is that all other
> tools in the OS thinks differently about name resolution
> and in a product that can be a problem.
>
> Changing the hosts file is a way to reconfigure the
> native resolver for the whole machine but only that machine.
> When more than one machine is involved you probably want
> to use what is in their common name resolving service.
>
> This is a trick that should work using strange longnames:
>
> erl -name pong@REDACTED
>
> erl -name ping@REDACTED
>
> 1> net_adm:ping('pong@REDACTED').
>
>
> You should also be able to use the working name like this:
>
> erl -name pong@REDACTED
>
> erl -name ping@REDACTED
>
> 1> net_adm:ping('pong@REDACTED').
>
>
> Both sides of the connection must aggree on their hostnames,
> and the hostname must work for creating the connection.
>
>
>
> To help debug your problem at hand the output of these is of interest:
> 2> io:format("~p.~n", [ets:tab2list(inet_db)]).
> 3> io:format("~p.~n", [ets:tab2list(inet_hosts_file_byname)]).
> 4> io:format("~p.~n", [ets:tab2list(inet_hosts_byname)]).
> 5> inet_gethost_native:gethostbyname("dyn-95-175-140-20").
> 6> inet_gethost_native:gethostbyname("dyn-95-175-140-20.inuknetworks.com
> ").
> 7> inet_gethost_native:gethostbyname("
> dyn-95-175-140-20.chaledi.unite.inuknetworks.com").
>
>
> On Thu, Oct 07, 2010 at 12:19:55AM +0100, Jiansen He wrote:
> > I tried adding both lines to both machines.  It still doesn't work.
> > Besides, can I bind two host names to the same IP in the same line?  It
> > doesn't looks like the form of sample binding.
> >
> > In addition, instead of changing the hosts file, could I "locally" change
> > the IPs/hostnames binding inside erlang?
> >
> > Regards
> > Jiansen
> >
> >
> >
> > On Wed, Oct 6, 2010 at 8:04 PM, Ahmed Omar <spawn.think@REDACTED>
> wrote:
> >
> > > Yes, you could try adding both machines IPs/hostnames combinations
> there
> > > so something like :
> > > 95.175.140.5    dyn-95-175-140-3
> dyn-95-175-140-3.inuknetworks.com
> > >
> > > 95.175.140.3    dyn-95-175-140-5
> dyn-95-175-140-5.inuknetworks.com
> > >
> > >
> > > On Wed, Oct 6, 2010 at 8:53 PM, Jiansen He <jiansenhe@REDACTED
> >wrote:
> > >
> > >>
> > >> Windows
> > >>
> > >> # Copyright (c) 1993-2009 Microsoft Corp.
> > >> #
> > >> # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
> > >> #
> > >> # This file contains the mappings of IP addresses to host names. Each
> > >> # entry should be kept on an individual line. The IP address should
> > >> # be placed in the first column followed by the corresponding host
> name.
> > >> # The IP address and the host name should be separated by at least one
> > >> # space.
> > >> #
> > >> # Additionally, comments (such as these) may be inserted on individual
> > >> # lines or following the machine name denoted by a '#' symbol.
> > >> #
> > >> # For example:
> > >> #
> > >> #      102.54.94.97     rhino.acme.com          # source server
> > >> #       38.25.63.10     x.acme.com              # x client host
> > >>
> > >> # localhost name resolution is handled within DNS itself.
> > >> #    127.0.0.1       localhost
> > >> #    ::1             localhost
> > >>
> > >>
> > >> Mac
> > >>
> > >> ##
> > >> # Host Database
> > >> #
> > >> # localhost is used to configure the loopback interface
> > >> # when the system is booting.  Do not change this entry.
> > >> ##
> > >> 127.0.0.1    localhost
> > >> 255.255.255.255    broadcasthost
> > >> ::1             localhost
> > >> fe80::1%lo0    localhost
> > >>
> > >>
> > >> Shall I write something to the host file?
> > >>
> > >> Many thanks
> > >> Jiansen
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> On Wed, Oct 6, 2010 at 7:16 PM, Ahmed Omar <spawn.think@REDACTED>
> wrote:
> > >>
> > >>> It seems to me like a problem with your hosts file (on Mac
> /etc/hosts, on
> > >>> windows %systemroot%\system32\drivers\etc\ )
> > >>>
> > >>> could you please post it here?
> > >>>
> > >>> On Wed, Oct 6, 2010 at 5:22 PM, Jiansen He <jiansenhe@REDACTED
> >wrote:
> > >>>
> > >>>> net:gethostbyaddr('95.175.140.20').
> > >>>>
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>> Best Regards,
> > >>> - Ahmed
> > >>> http://nl.linkedin.com/in/adiaa
> > >>>
> > >>
> > >>
> > >
> > >
> > > --
> > > Best Regards,
> > > - Ahmed
> > > http://nl.linkedin.com/in/adiaa
> > >
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
>


More information about the erlang-questions mailing list