erlang / otp

Erlang/OTP
http://erlang.org
Apache License 2.0
11.38k stars 2.95k forks source link

ERL-646: async_accept for gen_tcp and ssl #3637

Open OTP-Maintainer opened 6 years ago

OTP-Maintainer commented 6 years ago

Original reporter: juhlig Affected version: Not Specified Component: kernel Migrated from: https://bugs.erlang.org/browse/ERL-646


Over the past years, I noticed a lot of applications implementing asynchronous accept routines for tcp and ssl sockets, by either using the internal (and therefore, subject to possible unannounced breaking changes) prim_inet:async_accept function, or by running the respective accepts in spawned processes, inventing the wheel over and over.

I therefore propose async_accept methods directly in the gen_tcp and ssl modules/applications, in order to have a standardized, safe way to achieve asynchronous accepts, making the potentially dangerous use of prim_inet:async_accept unnecessary, and reducing boilerplate code.
OTP-Maintainer commented 6 years ago

vans163 said:

Along with this I want to propose to add multiple process recv for gen_udp from the same binded socket.

Currently UDP applications have no way in hell of scaling and WebRTC is everywhere these days.