[erlang-questions] Simple client handler "at the accept call" of a server

Dave Smith dizzyd@REDACTED
Sat Mar 8 17:48:27 CET 2008


On Sat, Mar 8, 2008 at 8:17 AM, Berlin Brown <berlin.brown@REDACTED> wrote:
> I have some client handling code, ideally it is pretty simple; but I
>  keep getting this function_clause error.
>
>  ** Reason for termination ==
>  ** {function_clause,
>        [{client_handler,terminate,
>             [{function_clause,
>                  [{client_handler,handle_info,
>                       [{tcp_closed,#Port<0.90>},
>                        {noreply,
>                            {client_state,<0.28.0>,undefined,starting,
>                                {client_info,<0.28.0>,<0.29.0>,#Port<0.90>},
>                                undefined,undefined}}]},

I believe this is saying:

No function that matches:
    client_handler:handle_info({tcp_closed, Port}, {noreply, {client_state}})

The actual bug lies in your handle_info method, wherein you're
clumping an additional "noreply" atom in your state:

  >     % Invoke the client data handler to process incoming messages.
  >     HandleState=client_handle_data(State, {Prefix, Command, Args}),
  >    {noreply, {noreply, State}};

Should be:

  >     % Invoke the client data handler to process incoming messages.
  >     HandleState=client_handle_data(State, {Prefix, Command, Args}),
  >    {noreply, State};

Hope that helps...

D.



More information about the erlang-questions mailing list