erlang 分布式编程问题

本文记录了一次使用Erlang进行并发编程时遇到的问题及解决方案。在尝试运行pingpong示例时,作者发现同一台MacOS机器上启动的两个节点无法互相通信。通过邮件列表的帮助,了解到在启动节点时添加@localhost参数可以解决问题。文中还对比了不同操作系统下的表现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这两天业余研究下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.
>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值