Erlang Mailing Lists

Author Message

<  Erlang  ~  "the book": chapter 11 irc lite exercises

simonc
Posted: Sun Sep 23, 2007 6:16 am Reply with quote
Joined: 23 Sep 2007 Posts: 2
I am stuck like you wouldn't believe on the exercises in chapter 11 of Programming Erlang.

I've read and re-read the chapter and the appendix on lib_chan and I realise I still don't understand how the irc lite application works.

Is there any alternative resource I can use to help me understand this? Or is there a simpler way in which I can ease myself into sockets?
View user's profile Send private message
simonc
Posted: Sun Sep 23, 2007 6:56 pm Reply with quote
Joined: 23 Sep 2007 Posts: 2
if I edit chat_client.erl to send a roster message like this:
Code:
wait_login_response(Widget, MM) ->
    receive
   {chan, MM, ack} ->
   send_roster(Widget, MM);   
   %active(Widget, MM);
   Other ->
       io:format("chat_client login unexpected:~p~n",[Other]),
       wait_login_response(Widget, MM)
    end.

send_roster(Widget, MM)->
    lib_chan_mm:send(MM, {roster}),
    active(Widget, MM).



then edit chat_group.erl to expect a message of the form {Pid, {roster}} like this:

Code:
   {Pid, roster}->
       io:format("~p@~p", [roster, Pid])





I always get the following message once I recompile and restart the server and client:

Code:
<0.32.0>
chat_client login unexpected:{'EXIT',<0.38.0>,connectorFinished}
chat_client login unexpected:{chan,<0.40.0>,{setController,<0.40.0>}}
chat_client login unexpected:{chan,<0.40.0>,{send,ack}}
chat_client login unexpected:{chan,<0.40.0>,
                                   {send,
                                       {msg,
                                           "joe",
                                           <0.37.0>,
                                           "I'm starting the group"}}}


even if i delete my edit from chat_client and chat_group so they are the same as when I unzipped the files and recompile all and restart, I get the above message.

It seems like I'm stuck in a loop and can't get out.

I must be doing something really stupid?
View user's profile Send private message

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