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

Arun Muralidharan <>
Tue Oct 30 07:58:52 CET 2012

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.


On Sun, Oct 28, 2012 at 12:48 PM, Arun Muralidharan <>wrote:

> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121030/b90f3248/attachment.html>

More information about the erlang-questions mailing list