[newbie] Erlangish way of Iterator pattern
Wed Jan 26 09:57:27 CET 2005
Gaspar Chilingarov wrote:
> as far as i can understand, there is no way to implement gen_server behavior
> when using gen_tcp ? i stuck, because i cannot think of place, where i should
> put accept() call :)
You can. This is one of the example of the French Erlang book
(Unfortunately, for which I am still struggling with my editor to have
translated in English).
Basically, you can use the handle_info callback to get message coming
from a socket in active mode. You can use tcp/ip stream regulation by
using the socket option active = once, so that after receiving new data
on the socket, you need to turn activation on again.
I hope this helps,
More information about the erlang-questions