我有一個簡單的服務器:不能產生一個簡單的服務器在二郎山
-module(simple_server).
-export([loop/0]).
loop() ->
receive
{fact, N, Sender} ->
Sender ! {factResult, fact(N), self()},
loop();
{fib, N, Sender} ->
Sender ! {fibResult, fib(N), self()},
loop();
{stop, Sender} ->
Sender ! ok
end.
fact(0) -> 1;
fact(N) -> N * fact(N - 1).
fib(N) -> fib(N, 1, 0).
fib(0, _B, A) -> A;
fib(N, B, A) -> fib(N-1, A+B, B).
然後我得到這個:
...\code>erl simple_server.erl
Eshell V5.7.5 (abort with ^G)
1> Server = spawn('[email protected]', fun simple_server:loop/0).
=ERROR REPORT==== 28-Jun-2010::10:46:29 ===
** Can not start erlang:apply,[#Fun<simple_server.loop.0>,[]] on [email protected]**
<0.33.0>
我錯過了什麼?
是的,我錯過了'-sname'國旗,謝謝! – 2010-06-28 09:03:25
對於'net_adm:ping/1'爲+1 – 2012-11-12 00:25:53