Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
-module(srv).
|
||||
-export([start/0, wait/0]).
|
||||
|
||||
start() ->
|
||||
net_kernel:start([srv,shortnames]),
|
||||
erlang:set_cookie(node(), rosetta),
|
||||
Pid = spawn(srv,wait,[]),
|
||||
register(srv,Pid),
|
||||
io:fwrite("~p ready~n",[node(Pid)]),
|
||||
ok.
|
||||
|
||||
wait() ->
|
||||
receive
|
||||
{echo, Pid, Any} ->
|
||||
io:fwrite("-> ~p from ~p~n", [Any, node(Pid)]),
|
||||
Pid ! {hello, Any},
|
||||
wait();
|
||||
Any -> io:fwrite("Error ~p~n", [Any])
|
||||
end.
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
-module(client).
|
||||
-export([start/0, wait/0]).
|
||||
|
||||
start() ->
|
||||
net_kernel:start([client,shortnames]),
|
||||
erlang:set_cookie(node(), rosetta),
|
||||
{ok,[[Srv]]} = init:get_argument(server),
|
||||
io:fwrite("connecting to ~p~n", [Srv]),
|
||||
{srv, list_to_atom(Srv)} ! {echo,self(), hi},
|
||||
wait(),
|
||||
ok.
|
||||
|
||||
wait() ->
|
||||
receive
|
||||
{hello, Any} -> io:fwrite("Received ~p~n", [Any]);
|
||||
Any -> io:fwrite("Error ~p~n", [Any])
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue