[newbie] Erlangish way of Iterator pattern

Bengt Kleberg bengt.kleberg@REDACTED
Wed Jan 26 10:04:46 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 :)

i think it can be done, if you want to.
one solution would be to put the accept/1 in another process and use 
cast/2 to send the socket to the gen_server.
if you want the accept/1 in the gen_server processs the problem is that 
accept/1 might block which would cause the gen_server to timeout. but 
use accept/2 and have the timeout shorter than the timeout for the 


More information about the erlang-questions mailing list