implementation of multiple timers

info <>
Fri Jun 11 18:45:56 CEST 2010


Hi all,
I would like to associate a timer to a gen_tcp. The loop is called by a gen_server.
As the number of sockets is unlimited in my application then the number of timers shall also be it.
According to your experience, what is the best approach for the implementation of the timers management ?
John
loop(socket)->
case gen_tcp:recv(Socket, 0) of
{ok, Data} ->
   timer(off),
   %handling of data
  timer(on),
  loop(socket);
{error,closed} ->
  timer(on),
  exit(normal)
end.


More information about the erlang-questions mailing list