这两天业余研究下erlang,看concurrent programming 的tutorial,发现例子里的ping pong在我这里怎么弄都运行不了(一个mac os开两个shell),后来在邮件列表里找到了答案,
只需在启动节点的时候加个@localhost就ok了,可能是新版本的问题,网上好多老版本的demo没这个问题。可能是改进吧。
http://erlang.org/pipermail/erlang-questions/2007-March/025836.html
考虑到国庆 把内容也贴下
P.S.: After some experimenting on my Windows XP PC (although with a newer version of erlang), I found there using "erl -sname" and "net_adm:ping('
')." would work. Using "@localhost" didn't fix the issue on CentOS/OpenVZ. When I called "erl_epmd:names()." on the XP machine it would list the two nodes (even if I'd started without "@localhost" for sname, but in that case ping didn't work). However trying "erl_epmd:names(). " on my CentOS/OpenVZ machine just froze for a long time and then eventually gave "{error,address}". For whatever it might be worth to any other folks :-} On 2/28/07, Raoul Duke <
> wrote: > > yes, unfortunately. > > if you have two nodes, on the same machine, with the same cookie, running the > > same version of the distribution protocol, if should work. > > > how about if you start the nodes like this; > > erl -sname
> > erl -sname
> > using "localhost" or "mail" (the name of the machine) only gave pangs. > > thanks for your time on this, i will chalk it up to my OpenVZ setup > being pathalogical. >