|
|
| Author |
Message |
< Erlang ~ [newbie] Starting xml-rpc server from cli |
| sv75 |
Posted: Fri Oct 19, 2007 9:28 am |
|
|
|
User
Joined: 19 Oct 2007
Posts: 10
|
I'm trying to use xmlrpc-1.13. Samples work fine, but I cannot understood why I fail to start xml-rpc from command-line (like "erlc test && erl -noshell -s test start"). It starts but does not listen any port. It works fine when I type "test:start()." from console. Any advices, please?
I tried this sample.
-module(test).
-export([start/0, handler/2]).
start() ->
{ok, Pid} = xmlrpc:start_link({?MODULE, handler}).
handler(_State, {call, f, [N]}) when integer(N) ->
{false, {response, [f(N)]}}.
f(N) -> N + N. |
|
|
| Back to top |
|
| francesco |
Posted: Sat Oct 20, 2007 8:24 am |
|
|
|
User
Joined: 07 Jul 2006
Posts: 249
Location: London
|
The directive can lead to strange behaviors as a result of processes linking to each other, trap_exit flags, and most important, the process which calls the function passed after -s terminating. (Note the xmlrpc:start_link call?). See if you can use xmlrpc:start instead, and things should work better.
Francesco
--
http://www.erlang-consulting.com |
|
|
| Back to top |
|
| sv75 |
Posted: Sat Oct 20, 2007 2:16 pm |
|
|
|
User
Joined: 19 Oct 2007
Posts: 10
|
francesco wrote: See if you can use xmlrpc:start instead, and things should work better.
Thanks a lot! There was no xmlrpc:start so I wrote it myself in ten seconds and it works! I'll continue to study Erlang then. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|