gen_tcp:send failing silently
fgonthier@REDACTED
fgonthier@REDACTED
Mon Feb 23 01:36:58 CET 2004
Hi all,
This weekend, I enjoy some recreational programming with Erlang. I've
decided to make a "proof-of-Erlang-goodness" IRC bot to show someone.
It's been months since I wrote my last Erlang code and my lack of
experience is showing:
connection_handle_data(Socket, [Data | R]) ->
% Handles PING
case regexp:match(Data, "PING :[0-9].*") of
{match, _, _} ->
Ping_String = string:substring(Data, 6, 16),
ok = gen_tcp:send(Socket, io_lib:format("PONG ~s~n", [Ping_String])),
io:fwrite("BLARG", []);
nomatch ->
ok
end,
factron_translator ! {incoming, Data},
connection_handle_data(Socket, R);
connection_handle_data(Socket, []) ->
ok.
This function is supposed to handle the PING message but the process
silently terminates after gen_tcp:send. "BLARG" is never displayed. I've
tried all I knew to try to get a clue on the failure, I'm probably missing
some debugging techniques.
Also, why is that when I write, for example, io:fwrite() in a process, I
get a compiler warning, but absolutely no runtime error? The process just
seem to go *ZAP* and die :(
François-Denis
More information about the erlang-questions
mailing list