【发布时间】:2011-12-09 03:31:31
【问题描述】:
这是我的 kvs.erl:
-module(kvs).
-export([start/0, store/2, lookup/1]).
start() -> register(kvs, spawn(fun() -> loop() end)).
store(Key, Value) -> rpc({store, Key, Value}).
lookup(Key) -> rpc({lookup, Key}).
rpc(Q) ->
kvs ! {self(), Q},
receive
{kvs, Reply} ->
Reply
end.
loop() ->
receive
{From, {store, Key, Value}} ->
put(Key, {ok, Value}),
From ! {kvs, true},
loop();
{From, {lookup, Key}} ->
From ! {kvs, get(Key)},
loop()
end.
当我使用 :erl -name zhao -setcookie abc 启动 erlang 时
然后:rpc:call(fifar@huihua.sohu-inc.com,kvs,store,[weather,cold])。
显示错误:
(zhao@zjm1126.sohu-inc.com)1> rpc:call(fifar@huihua.sohu-inc.com,kvs,store,[weather,cold]).
** exception error: bad argument in an arithmetic expression
in operator -/2
called as 'fifar@huihua.sohu' - 'inc.com'
我认为是关于 linux 主机名,
但我使用这个 linux shell:主机名 -a
无法显示“huihua.sohu-inc.com”
那我该怎么办,
谢谢
【问题讨论】: