<div dir="ltr">Thanks Joe<div><br></div><div>I will do that and let you know if I face any issues</div><div>+ Harit Himanshu</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 24, 2015 at 9:48 AM, Joe Armstrong <span dir="ltr"><<a href="mailto:erlang@gmail.com" target="_blank">erlang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">lib_chan is the code tarball that accompanies the book<div><br></div><div>Go to <a href="https://pragprog.com/titles/jaerlang2/source_code" target="_blank">https://pragprog.com/titles/jaerlang2/source_code</a></div><div><br></div><div>and download the source code from the book <br></div><div><br></div><div>lib_chan.erl is in the sub directory of the unpacked code called</div><div>"socket_dist".</div><div><br></div><div>The examples in the book should work if you change directory to</div><div>socket_dist and run the makefle in this directory.</div><div><br></div><div>Hope this helps</div><div><br></div><div>/Joe</div><div><br></div><div><br></div><div><br></div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Sat, Jan 24, 2015 at 3:44 PM, Harit Himanshu <span dir="ltr"><<a href="mailto:harit.subscriptions@gmail.com" target="_blank">harit.subscriptions@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">I am learning Erlang from Joe's book and one of the thing he teaches is about socket programming.  <div>His code example runs like  </div><div><table style="margin:0.7em 0px;color:rgb(0,0,0);font-family:verdana,sans-serif;font-size:18px"><tbody><tr style="margin-top:0px;margin-bottom:0px"><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><span style="font-family:DroidSerif;font-weight:bold;font-size:14px"> </span></td><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><div style="white-space:pre-wrap;font-family:DroidSansMono">1><strong style="color:rgb(144,17,125)"> kvs:start().</strong>
</div></td></tr><tr style="margin-top:0px;margin-bottom:0px"><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><span style="font-family:DroidSerif;font-weight:bold;font-size:14px"> </span></td><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><div style="white-space:pre-wrap;font-family:DroidSansMono">true
</div></td></tr><tr style="margin-top:0px;margin-bottom:0px"><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><span style="font-family:DroidSerif;font-weight:bold;font-size:14px"> </span></td><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><div style="white-space:pre-wrap;font-family:DroidSansMono">2><strong style="color:rgb(144,17,125)"> lib_chan:start_server().</strong>
</div></td></tr><tr style="margin-top:0px;margin-bottom:0px"><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><span style="font-family:DroidSerif;font-weight:bold;font-size:14px"> </span></td><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><div style="white-space:pre-wrap;font-family:DroidSansMono">Starting a port server on 1234...
</div></td></tr><tr style="margin-top:0px;margin-bottom:0px"><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><span style="font-family:DroidSerif;font-weight:bold;font-size:14px"> </span></td><td valign="top" style="font-family:DroidSansMono,Mincho;line-height:1.2;font-size:16px;padding-top:0px;padding-bottom:0px"><div style="white-space:pre-wrap;font-family:DroidSansMono">true</div></td></tr></tbody></table></div><div><br></div><div>I try to do the same thing with code he provided  </div><div><div>-module(mod_name_server).</div><div>-author("harith").</div><div><br></div><div>%% API</div><div>-export([start_me_up/3]).</div><div><br></div><div>start_me_up(MM, _ArgsC, _ArgsS) -></div><div>  loop(MM).</div><div><br></div><div>loop(MM) -></div><div>  receive</div><div>    {chan, MM, {store, K, V}} -></div><div>      kvs:store(K, V),</div><div>      loop(MM);</div><div>    {chan, MM, {lookup, K}} -></div><div>      MM ! {send, kvs:lookup(K)},</div><div>      loop(MM);</div><div>    {chan_closed, MM} -></div><div>      true</div><div>  end.</div></div><div><br></div><div><br></div><div>But when I run, I see following  </div><div><p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">1> c(kvs).</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">{ok,kvs}</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">2> c(mod_name_server).</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">{ok,mod_name_server}</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">3> kvs:start().</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">true</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">4> lib_chan:start().</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">** exception error: undefined function lib_chan:start/0</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">5> lib_chan_mm:start().</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">** exception error: undefined function lib_chan_mm:start/0</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);background-color:rgb(2,43,54)">6> </p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(131,148,150);min-height:15px;background-color:rgb(2,43,54)"><br></p></div><div>I even tried for lib_chan_mm, but no luck</div><div><br></div><div>What is going wrong here?</div><div><br></div><div>Thank you</div><span><font color="#888888"><div>+ Harit Himanshu </div></font></span></div>
<br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>