[erlang-questions] Noob Question ...

Richard Andrews <>
Fri Mar 6 12:50:13 CET 2009

The immediate thing that strikes me is that "" should be {127,0,0,1}. In gen_tcp (erlang in general) the address is a tuple not a string.

See man 3 inet for more info.

Debugging becomes easier with experience. function_clause means you tried to call a function with the wrong argument type. Probably because you tried to pass a list (aka string) instead of a tuple to connect().

The rest of that section after function_clause is a stack trace. In this case it doesn't tell you much but it would be helpful if the failure occurred deeper into a call stack.


client([Port]) ->
    case gen_tcp:connect("", Port, [list,{packet,0}]) of
        {ok, Socket} ->
            gen_tcp:send(Socket,"auth iltd!dy69?\r\n\r\n"),
            gen_tcp:send(Socket,"event plain text\r\n\r\n"),
        {error, Reason} ->

      Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox

More information about the erlang-questions mailing list