Beginner OTP question

Bill Mill bill.mill@REDACTED
Fri Feb 18 04:25:18 CET 2005

Hey everyone, all I want to do is get a very simple example of two
erlang processes talking to each other. The only additional
complication is that I want one of them to be a gen_server.

I have written a minimal OTP gen_server that looks like:

%%%%%%%%%%%  myserver.erl %%%%%%%%%%


-export([start/0, init/1, send/0, handle_call/3]).

start() ->
    gen_server:start({global, myserver}, myserver, [], []).

init(_Args) ->
    {ok, ""}.

send() ->
    gen_server:call(myserver, send).

handle_call(send, From, _State) ->
    io:format("send called from ~p", [From]),
    {reply, "Thanks for calling", ""}.
%%%%%%%% end myserver.erl %%%%%%%%%

and then started it like:

/c/code/erlang/myserver$ erl -sname hello
Erlang (BEAM) emulator version 5.4.3 [source] [hipe]

Eshell V5.4.3  (abort with ^G)
(hello@REDACTED)1> myserver:start().

How would I go about starting another process and getting it to
communicate with this server? Here's what I expect to work, which
obviously doesn't:

/c/code/erlang/test$ erl -sname gbye
Erlang (BEAM) emulator version 5.4.3 [source] [hipe]

Eshell V5.4.3  (abort with ^G)
(gbye@REDACTED)1> {myserver, myserver@REDACTED} ! send.

Am i missing something fundamental here? How could I get "gbye" to
talk to "hello"? Is there something wrong with the server?

Bill Mill
bill.mill at

More information about the erlang-questions mailing list