rcp:cast/4 example?

Bengt Kleberg <>
Wed Mar 28 10:00:53 CEST 2001



> From: "andy allen" <>
...deleted
> I'm looking for advice on a simple example of rpc:cast/4.
> 
...deleted
> 
> To make certain that the function I am casting to works, I can call it with 
> the following line from an Erlang shell:
> 
> mlgCpt:trace_call({{switch_dev_id, 1}, {channel, all}}).
> 
> It executes past a "SYS_DBG" statement, then crashes. But when I cast to it, 
> it should at least execute the "SYS_DBG" statement, right?
> 
> -=-=-
> 
> For the uninitiated:
> 1. rpc is a library in the standard Erlang distribution,
> 2. ?SYS_DBG is a macro that works like a printf.

 
Greetings,

Since you do not explicitly state the result of the cast I am assuming
that nothing happens. Please correct me if I am wrong.

The most interesting part is this:
 > 2. ?SYS_DBG is a macro that works like a printf.
(may I assume that you mean io:format(), and not printf() :-)

Anyway, it seems to be impossible to do io:format() from
rpc:cast/call(). The things one wants displayed end up on the calling
node, not the node one did the rcp call to. Strange, but true. So, have
you tried rpc:call(Node, mlgCpt, trace_call, [Data])? This to make
certain that ?SYS_DBG actually displys on the right node. When rpc:call
works it would be time to switch to rpc:cast.

Bengt Kleberg



More information about the erlang-questions mailing list