[erlang-questions] Problems when running distributed pingpong
Wed Oct 6 00:29:42 CEST 2010
I'm new to Erlang. I tried to run the distributed pingpong program which
could be found at http://www.erlang.org/doc/getting_started/conc_prog.html.
The program works well when I run it in two terminals on the same machine.
However, it doesn't work when I try to run it on two computers. I posted my
testing result as follows.
on Machine1 (Mac OS X Version 10.6.4)
$ erl -sname pong
Erlang R14B (erts-5.8.1) [source] [smp:4:4] [rq:4] [async-threads:0] [hipe]
Eshell V5.8.1 (abort with ^G)
On Machine2 (Windows 7)
>werl -sname ping
Erlang R14B (erts-5.8.1) [smp:2:2] [rq:2] [async-threads:0]
Eshell V5.8.1 (abort with ^G)
Nothing happened on both sides:(
To find the problem, I opened another terminal on both machines.
Pinging 184.108.40.206 with 32 bytes of data:
Reply from 220.127.116.11: bytes=32 time=4ms TTL=64
Reply from 18.104.22.168: bytes=32 time=1ms TTL=64
Reply from 22.214.171.124: bytes=32 time=34ms TTL=64
Reply from 126.96.36.199: bytes=32 time=10ms TTL=64
Ping statistics for 188.8.131.52:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 34ms, Average = 12ms
dyn-95-175-140-5:~ $ ping -c4 184.108.40.206
PING 220.127.116.11 (18.104.22.168): 56 data bytes
64 bytes from 22.214.171.124: icmp_seq=0 ttl=128 time=1.491 ms
64 bytes from 126.96.36.199: icmp_seq=1 ttl=128 time=0.388 ms
64 bytes from 188.8.131.52: icmp_seq=2 ttl=128 time=0.399 ms
64 bytes from 184.108.40.206: icmp_seq=3 ttl=128 time=0.811 ms
--- 220.127.116.11 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.388/0.772/1.491/0.449 ms
So, those two machines are connected to the same Ethernet and they can ping
each other. I turned off the firewall but the program still doesn't work:(
To find more information about my network, I reopen the erlang system on Mac
with -name option
Then I open erlang system on Windows with -name option...
It is clear that the erlang system could only recognize another host where
anthor erlang system is running. And, more importantly, I get host names
that is known by my local DNS server.
It shows that the magic cookies are set correctly on both machines.
It suggests that I should use hostname that has the form
To summarize. my two computers are connected to the same Ethernet. The
only difference between two IP addresses is the last digit. Firewalls are
closed on both machines. Computers can ping each other from the outside of
Erlang system. Inside the Erlang system, one machine could have at least 3
valid host names from DNS server's point of view. However, only one of them
is valid for net_adm:ping/1, if Erlang is invoked with -name option. An
Erlang system could detect another host where another Erlang system is
running. Somehow, an Erlang system cannot communicate with an Erlang node
in another Erlang system.
More information about the erlang-questions