<p>register() does not support remote process because it can not recognize remote pod(), I guess.</p>
<p>Regards,<br>
Barco</p>
<div class="gmail_quote">On Oct 27, 2011 4:34 AM, "Geoff Cant" <<a href="mailto:nem@erlang.geek.nz">nem@erlang.geek.nz</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2011-10-26, at 08:25 , Paul Barry wrote:<br>
> Q2. Being able to register a spawned process is cool, but why can't I<br>
> register a process that is spawned remotely? That is, why does this<br>
> line of code give me a "badarg"?<br>
><br>
> register(the_board, spawn('server@localhost', displayboard,<br>
> putmessage, [])).<br>
<br>
<br>
You can only register local pids and ports. I'm not sure why this restriction is enforced - maybe the erts people have more information.<br>
<br>
In practice it's easy to work around. Register the name on the remote node and then use the {the_board, 'server@localhost'} ({RegisteredName, Node}) form instead of using a bare registered name or pid. This form is a valid argument to the ! send function.<br>
<br>
As others have mentioned there are other process registries you can use (gproc, ngproc, proc_reg, global) that allow the registration of remote pids (and usually allow names to be terms instead of just atoms).<br>
<br>
Cheers,<br>
--<br>
Geoff Cant<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>