problem getting two erlangs to chat

Martin J. Logan <>
Wed Sep 3 23:28:42 CEST 2003


Garry, 
   Before you do your net_adm:ping go ahead and type nodes(). What do
you get? After you do your net adm ping I am assuming that nodes() will
yield [, '']. The problem is most
likely that your nodes are not connected, that is to say your net
kernels don't have a record of one another. 

Cheers,
Martin


On Wed, 2003-09-03 at 14:55, Garry Hodgson wrote:
> 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:
> 
>     ()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:
> 
>     ()2> net_adm:ping( '' ).
>     pong
> 
> and after that, it works:
> 
>     ()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