[erlang-questions] undefined function lib_chan:start/0
Joe Armstrong
erlang@REDACTED
Sat Jan 24 18:48:38 CET 2015
lib_chan is the code tarball that accompanies the book
Go to https://pragprog.com/titles/jaerlang2/source_code
and download the source code from the book
lib_chan.erl is in the sub directory of the unpacked code called
"socket_dist".
The examples in the book should work if you change directory to
socket_dist and run the makefle in this directory.
Hope this helps
/Joe
On Sat, Jan 24, 2015 at 3:44 PM, Harit Himanshu <
harit.subscriptions@REDACTED> wrote:
> I am learning Erlang from Joe's book and one of the thing he teaches is
> about socket programming.
> His code example runs like
>
> 1>* kvs:start().*
>
> true
>
> 2>* lib_chan:start_server().*
>
> Starting a port server on 1234...
>
> true
>
> I try to do the same thing with code he provided
> -module(mod_name_server).
> -author("harith").
>
> %% API
> -export([start_me_up/3]).
>
> start_me_up(MM, _ArgsC, _ArgsS) ->
> loop(MM).
>
> loop(MM) ->
> receive
> {chan, MM, {store, K, V}} ->
> kvs:store(K, V),
> loop(MM);
> {chan, MM, {lookup, K}} ->
> MM ! {send, kvs:lookup(K)},
> loop(MM);
> {chan_closed, MM} ->
> true
> end.
>
>
> But when I run, I see following
>
> 1> c(kvs).
>
> {ok,kvs}
>
> 2> c(mod_name_server).
>
> {ok,mod_name_server}
>
> 3> kvs:start().
>
> true
>
> 4> lib_chan:start().
>
> ** exception error: undefined function lib_chan:start/0
>
> 5> lib_chan_mm:start().
>
> ** exception error: undefined function lib_chan_mm:start/0
>
> 6>
>
>
> I even tried for lib_chan_mm, but no luck
>
> What is going wrong here?
>
> Thank you
> + Harit Himanshu
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150124/7c016135/attachment.htm>
More information about the erlang-questions
mailing list