[erlang-questions] How can i evaluate gen_server:call/cast cross nodes?
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Wed Apr 2 08:41:04 CEST 2008
State#state.authsrv contains {<5661.50.0>}, which is of
type {pid()}.
The gen_server:call/2 function expects the following
type of the first argument:
ServerRef = Name | {Name,Node} | {global,GlobalName} | pid()
Node = atom()
GlobalName = term()
(... and Name = atom(), one might add.)
BR,
Ulf W
wenew zhang skrev:
> It's works on erl shell:
>
> Pid=global:whereis_name(authserver).
> <5661.50.0>
> (indexservernode@REDACTED
> <mailto:indexservernode@REDACTED>)5>
> Uid=list_to_binary("root").
> <<"root">>
> (indexservernode@REDACTED
> <mailto:indexservernode@REDACTED>)6>
> Pwd=list_to_binary("12345").
> <<"12345">>
> (indexservernode@REDACTED
> <mailto:indexservernode@REDACTED>)12>
> Result=gen_server:call(Pid,{213,Uid,Pwd}).
> 0%% the normal result
>
> Code examples:
> io:format("rcv:~w AuthPid~w ~n",[Data,State#state.authsrv]),
> %global:sync(),
>
> Result=gen_server:cast(State#state.authsrv,{?PLLOGIN,Uid,Pwd}), %%even
> no data send to the authsrv,
> io:format("Result:~w~n",[Result]),
>
> Error Mesage:________________begin_________________________________________
> rcv:<<0,4,97,115,100,102,0,5,115,97,102,115,100>> AuthPid{<5661.50.0>}
> %% the authsrv Pid
> =ERROR REPORT==== 2-Apr-2008::08:02:35 ===
> ** State machine <0.58.0> terminating
> ** Last message in was {tcp,#Port<0.115>,
> <<0,6,97,97,115,97,97,97,0,5,98,98,98,98,98>>}
> ** When State == 'WAIT_FOR_DATA'
> ** Data == {state,#Port<0.115>,{192,168,0,221},{<5661.62.0>}}
> ** Reason for termination =
> ** {{function_clause,[{gen,call,
> [{<5661.62.0>},
> '$gen_call',
> {213,<<"aasaaa">>,<<"bbbbb">>},
> 5000]},
> {gen_server,call,2},
> {indexserver,'WAIT_FOR_DATA',2},
> {gen_fsm,handle_msg,7},
> {proc_lib,init_p,5}]},
> {gen_server,call,
> [{<5661.62.0>},{213,<<"aasaaa">>,<<"bbbbb">>}]}}
> _______________end________________________________
> What's problem with it?
>
> Best Regards
>
> Wenew Zhang
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list