Quantcast

prim_inet:async_accept/2

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

prim_inet:async_accept/2

Nicolas Thauvin
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
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: prim_inet:async_accept/2

Christian S-2
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 <[hidden email]> 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
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Loading...