<div dir="ltr">You're calling gen_server:start() with the wrong arguments. This may help:<br><br><span style="font-family: courier new,monospace;">25> c(ping).                                                      </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">./ping.erl:7: Warning: variable 'Args' is unused</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">./ping.erl:10: Warning: variable 'From' is unused</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">./ping.erl:10: Warning: variable 'Request' is unused</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">./ping.erl:14: Warning: variable 'Request' is unused</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">./ping.erl:17: Warning: variable 'Info' is unused</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">./ping.erl:20: Warning: variable 'Reason' is unused</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">./ping.erl:20: Warning: variable 'State' is unused</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">./ping.erl:23: Warning: variable 'Extra' is unused</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">./ping.erl:23: Warning: variable 'OldVsn' is unused</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">{ok,ping}</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">26> {ok, Pid} = gen_server:start({local, myserver}, ping, [], []).</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">{ok,<0.97.0>}</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">27> gen_server:call(myserver, some_request).                      </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">"Pong"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">28> gen_server:call(myserver, {arbitrarily_complex,[some_request]}).</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">"Pong"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">29> exit(Pid,normal).</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">true</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">30> erlang:is_process_alive(Pid).</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">true</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">31> exit(Pid,shutdown).          </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">true</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">32> erlang:is_process_alive(Pid).</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">false</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">33> f(Pid).</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ok</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">34> {ok, Pid} = gen_server:start(ping, [], []).                     </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">{ok,<0.106.0>}</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">35> gen_server:call(Pid, some_request).                             </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">"Pong"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">36> exit(Pid,shutdown).                        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">true</span><br style="font-family: courier new,monospace;">
<br><br><div class="gmail_quote">On Tue, Sep 30, 2008 at 10:58 PM, David Lloyd <span dir="ltr"><<a href="mailto:lloy0076@adam.com.au">lloy0076@adam.com.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi There,<br>
<br>
My source is:<br>
<br>
-module(ping).<br>
-behaviour(gen_server).<br>
<br>
-export([init/1, terminate/2, code_change/3]).<br>
-export([handle_call/3, handle_cast/2, handle_info/2]).<br>
<br>
init(Args) -><br>
     {ok, "Started"}.<br>
<br>
handle_call(Request, From, State) -><br>
     true,<br>
     {reply, "Pong", State}.<br>
<br>
handle_cast(Request, State) -><br>
     {stop, "Not implemented", State}.<br>
<br>
handle_info(Info, State) -><br>
     {stop, "Not implemented", State}.<br>
<br>
terminate(Reason, State) -><br>
     true.<br>
<br>
code_change(OldVsn, State, Extra) -><br>
     State.<br>
<br>
<br>
bash-3.00$ erl<br>
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0]<br>
[kernel-poll:false]<br>
<br>
Eshell V5.5.5  (abort with ^G)<br>
1> c(ping).<br>
./ping.erl:7: Warning: variable 'Args' is unused<br>
./ping.erl:10: Warning: variable 'From' is unused<br>
./ping.erl:10: Warning: variable 'Request' is unused<br>
./ping.erl:14: Warning: variable 'Request' is unused<br>
./ping.erl:17: Warning: variable 'Info' is unused<br>
./ping.erl:20: Warning: variable 'Reason' is unused<br>
./ping.erl:20: Warning: variable 'State' is unused<br>
./ping.erl:23: Warning: variable 'Extra' is unused<br>
./ping.erl:23: Warning: variable 'OldVsn' is unused<br>
{ok,ping}<br>
2> gen_server:start({ok, pserv}, ping, {args}, []).<br>
<br>
=ERROR REPORT==== 1-Oct-2008::12:23:47 ===<br>
Error in process <0.30.0> with exit value:<br>
{function_clause,[{gen,where,[{ok,pserv}]},{gen,start,6},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}<br>
<br>
** exited: {undef,[{shell_default,handle_call,[1,2,3]},<br>
                    {erl_eval,do_apply,5},<br>
                    {shell,exprs,6},<br>
                    {shell,eval_loop,3}]} **<br>
<br>
However, if I remove the "true, " in the source, the gen_server starts.<br>
<br>
I can't figure out what's causing this behaviour and I'm looking at the<br>
STDLIB documents and Programming Erlan.<br>
<br>
DSL<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
</blockquote></div><br></div>