[erlang-questions] How access the gen_server across the network

Kevin A. Smith kevin@REDACTED
Fri Aug 7 17:49:17 CEST 2009


On Aug 7, 2009, at 11:12 AM, Oscar wrote:

> Now it works.
> But  I still have two questions.
>
> 1. Must it connect the two nodes before trying the gen_server call?

Yes, connecting the two nodes is required. Synchronizing each node's  
view of the global namespace is part of the node connection process.

> 2. Shall we make users decide to register it locally or globally while
> designing the gen_server behavior?

There is another option besides local or global registration.  
gen_server understands how to send messages with a ServerRef formatted  
like so: {RegisteredName, NodeName} where RegisteredName is a locally  
registered name. gen_server's manpages go into more detail.

--Kevin

>
> Is there any good examples in ERLANG source package?
>
> On Fri, Aug 7, 2009 at 8:46 PM, Oscar<ro4tub@REDACTED> wrote:
>> yes. net_kernel:connect_node(server@REDACTED). returns true, but
>> erlang:nodes(). returns an empty list.
>>
>>
>> On Fri, Aug 7, 2009 at 8:34 PM, Kevin A. Smith<kevin@REDACTED 
>> > wrote:
>>> Do you connect the two nodes, either via net_adm:ping/1 or
>>> net_kernel:connect_node/1, before trying the gen_server call? If  
>>> so, you
>>> might try running the sasl application on both nodes and  
>>> recreating the
>>> error. SASL will provide a ton of crash information which can be  
>>> really
>>> handy when debugging these types of failures.
>>>
>>> --Kevin
>>> On Aug 7, 2009, at 8:28 AM, Oscar wrote:
>>>
>>>> I've start the gen_server via gen_server:start_link({global,
>>>> game_time_service}, ...) and access the service via
>>>> gen_server:call({global, game_time_service}, get_time).
>>>>
>>>> It throws the nprpoc exception when I access it.
>>>>
>>>> Any suggestions?
>>>>
>>>> Thanks.
>>>>
>>>> ________________________________________________________________
>>>> erlang-questions mailing list. See http://www.erlang.org/faq.html
>>>> erlang-questions (at) erlang.org
>>>>
>>>
>>>
>>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>



More information about the erlang-questions mailing list