[erlang-questions] How erlang gen_server gets "tcp_close" message

27 views
Skip to first unread message

Arun Muralidharan

unread,
Oct 28, 2012, 3:18:58 AM10/28/12
to erlang-q...@erlang.org
Hello Folks,
This might be a simple question, but I would like to know how erlang gen_server gets the async message "tcp_close" when the server to which the gen_server has made connections to has crashed. (Ofcourse I am talking about non blocking sockets here)

From what I know (after googling too) is that it takes atleast one send on the connection to get to know if the connection has been reset, in which we case we get the error ECONNRESET.

But in case of my gen_server, it got the message "tcp_close" as soon as I brought down the server (kill -9) (Note that gen_server was not sending any data to the server).

Can anybody shed some light on it ?


Thanks.

Arun Muralidharan

unread,
Oct 30, 2012, 2:58:52 AM10/30/12
to erlang-q...@erlang.org
[CLOSED]
Simulated the same using a small python script, where client process was blocked on select. On crashing the server, the Input bit mask of the select got triggered (Which I didnt know :) ), now on recv if data read = 0, then I know that the connection was closed and call the respective handler.

-Arun
Reply all
Reply to author
Forward
0 new messages