[erlang-questions] Local and remote sends

Vlad Dumitrescu <>
Tue Oct 31 13:47:08 CET 2006


Hi,

On 10/31/06, Bob Cowdery <> wrote:
> I guess I need to test the address and see what form it is. Do you know of any simple way to determin a Pid from a short address apart from looking at the makeup and deducing what it is.

Try is_pid(Pid) ;-)

How does From get set?

The "right" way is to receive it from the client (who sends a Pid) and
then it can be used as From ! Message regardless of whether it's local
or remote. This means the C node has to send it's pid to a registered
process on the Erlang node first.

Of course, if the Erlang side has to initiate the conversation,
there's little choice. Something like the following might make it more
portable

-ifdef(LOCAL_TEST).
-define(DEST, local_process_name).
-else.
-define(DEST, {any, }).
-endif.
.....
    ?DEST! GatewayPid.

best regards,
Vlad



More information about the erlang-questions mailing list