problem getting two erlangs to chat
Garry Hodgson
garry@REDACTED
Wed Sep 3 21:55:08 CEST 2003
i'm having a problem getting two erl's to talk to each other.
i suspect this'll be obvious to y'all, but i's escaping me.
the server is written as a gen_server, with a start() that looks like:
start() ->
gen_server:start( { global, orbe }, orbe, [], [] ).
it gets started with:
erl -setcookie cookie -name orbe -s orbe start
so far, so good. i want to control it via a separate program
that invokes erlang to run a getProcesses() function:
getProcesses() ->
gen_server:call( { global, orbe }, getProcesses ).
i run this one with:
erl -setcookie cookie -name foo
when i try and invoke getProcesses(), i get an error:
(foo@REDACTED)1> orbe:getProcesses().
** exited: {noproc,{gen_server,call,[{global,orbe},getProcesses]}} **
so i ping it, to see if the other node (on the same machine, incidentally)
is alive:
(foo@REDACTED)2> net_adm:ping( 'orbe@REDACTED' ).
pong
and after that, it works:
(foo@REDACTED)3> orbe:getProcesses().
[{fred,cat,#Port<3942.37>,63229822226},
{barney,cat,#Port<3942.38>,63229822226}]
so, the question is, what am i neglecting to do
that the net_adm:ping() is doing for me?
is this a reasonable mechanism for controlling a
running erlang server? the intent is to have a script
that will invoke something like "erl -s orbe status"
or "erl -s orbe reset" to control the server, probably
from someone else's CGI scripts (part of a bigger system,
so i can't rewrite the whole thing or yaws or whatever).
i'm open to suggestions as to a better way.
thanks
----
Garry Hodgson, Technology Consultant, AT&T Labs
Be happy for this moment.
This moment is your life.
More information about the erlang-questions
mailing list