I'm sorry but the half of my initial message hasn't been send (why? I don't know).
I was saying that I knew about the #arg.clisock but I didn't know how can I receive the message {tcp_closed, S}.
here is the doc about inet and {tcp_socket, S} :

I have a such structure for my comet-style application (it's very simplified) :

out(A) ->
   mnesia:subscribe({table, minichat, simple})

loop() ->
      {mnesia_table_event, {write, _, _}} ->
         mnesia:unsubscribe({table, minichat, simple});
      _ ->
   after 1000 * 60 * 60 -> % (1 hour) because I don't know when the tcp socket will be closed
      mnesia:unsubscribe({table, minichat, simple})

Basically I just want to add a {tcp_closed, _} to the receive statement but it doesn't work.

Do you have any idea about this problem ?

Thanks in advance


On Nov 13, 2007 4:56 PM, Claes Wikstrom <> wrote:
Greg Burri wrote:
> Hi,
> Is it possible to know when a socket connection are closing ?
> In a comet-style web application (using appmods) I have to hold the
> connection and wait for a mnesia event with

Absolutely, you have full access to the socket. It's in the
#arg{} record for you to use as you wish.