简单的分布式Erlang [英] Simple Distributed Erlang

查看:154
本文介绍了简单的分布式Erlang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的模块:

-module(dist).
-compile([add/3]).
add(From,X,Y) ->
    From ! X+Y.

我正在启动两个节点。

One with

erl -sname foo 

另一个与

erl -sname bar

在我正在做的酒吧节点上:

On the bar node I'm doing:

> c(dist).
{ok,dist}
> self().
<0.37.0>
> spawn('foo@unknown-00-23-6c-83-af-bd', dist, add, [self(), 3, 5]).

但我得到的回应是:

Error in process <0.48.0> on node 'foo@unknown-00-23-6c-83-af-bd' with exit value: {undef,[{dist,add,[<8965.37.0>,3,5]}]}

这个错误是什么意思?我想知道这是否意味着我的foo节点没有定义此模块?我不认为它需要它,但问题并不是通过在foo节点编译dist来修复,所以我猜这不是问题。

What does this error mean? I wondered if it meant that my foo node doesn't have this module defined? I didn't think it needed it, but the problem wasn't fixed by compiling dist in the foo node so I guess this isn't the problem.

推荐答案

导出add / 3。而不是一个编译选项。

Export the add/3. Instead of a compile option.

-export([add/3]).

这篇关于简单的分布式Erlang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆