[erlang-questions] Local and remote sends

Bob Cowdery <>
Tue Oct 31 14:37: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 client passes its address in the message

> 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.
As far as I know a CNode does not have a Pid unless I read the documentation wrong. It only has a short or long name.

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.

Not investigated macros yet. Mind you, there's lots I've not investigated yet. The simple Pid test seems to have fixed the actual problem although it's probably not the 'right' way to do it.

regards
Bob





More information about the erlang-questions mailing list