Erlang/OTP Forums

Author Message

<  Erlang  ~  [newbie] Starting xml-rpc server from cli

sv75
Posted: Fri Oct 19, 2007 9:28 am Reply with quote
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.
View user's profile Send private message Send e-mail
francesco
Posted: Sat Oct 20, 2007 8:24 am Reply with quote
User Joined: 07 Jul 2006 Posts: 249 Location: London
The
Code:
-s Mod Func Args
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
View user's profile Send private message Visit poster's website
sv75
Posted: Sat Oct 20, 2007 2:16 pm Reply with quote
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.
View user's profile Send private message Send e-mail

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

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