gen_tcp:send failing silently
François-Denis Gonthier
neumann@REDACTED
Sun Feb 22 22:03:34 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
This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.
E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.
More information about the erlang-questions
mailing list