[erlang-questions] Noob Question ...
Shelby Ramsey
sicfslist@REDACTED
Fri Mar 6 03:22:13 CET 2009
Hello!
I'm trying to become an erlang convert (from Python) and I do mostly network
programming.
So I wrote up this little tidbit:
-module(test).
-export([client/1]).
client([Port]) ->
case gen_tcp:connect("127.0.0.1", 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"),
loop(Socket);
{error, Reason} ->
print_stuff([Reason]),
ok
end.
loop(Socket) ->
case gen_tcp:recv(Socket, 0) of
{ok, Data} ->
print_stuff([Data]),
loop(Socket);
{error, closed} ->
ok
end.
print_stuff([Text]) ->
io:format("~w", [Text]).
It compiles ... but when I run ... well ... it spits this:
=ERROR REPORT==== 5-Mar-2009::20:19:27 ===
Error in process <0.30.0> with exit value:
{function_clause,[{test,client,[8021]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
** exited: {function_clause,[{test,client,[8021]},
{erl_eval,do_apply,5},
{shell,exprs,6},
{shell,eval_loop,3}]} **
So what did I hose up? And more importantly ... where is some documentation
re: how to debug the "error report".
Thanks for any assistance!
SDR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090305/66c331f5/attachment.htm>
More information about the erlang-questions
mailing list