[erlang-questions] prim_inet:async_accept/2

Christian chsu79@REDACTED
Tue Feb 17 16:57:37 CET 2009


Why not use plain gen_tcp:accept() and then gen_server:enter_loop() ?

With an accept timout you can fall out and poll for mailbox messages and get
back into trying to accept again, making it semi-active.

About prim_inet being safe to use, what I have picked up pretty clearly from
OTP is that if-it-isnt-documented-it-should-not-be-depended-on.

On Tue, Feb 17, 2009 at 16:49, Nicolas Thauvin <nthauvin@REDACTED>wrote:

> Hello,
>
>  prim_inet:async_accept/2 looks like a very interesting function to use in
> a gen_server. However, it is not documented.
>  Several examples on the Internet already use it (like
>
> http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles
> ).
>
> Questions are:
> - Why isn't it wrapped in gen_tcp ?
> - Is it safe to use it (will it be obsolete in the next release ?) ?
>
> Cheers,
>
> -- Nicolas
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090217/26ee23f3/attachment.htm>


More information about the erlang-questions mailing list