msantos / procket

Erlang interface to low level socket operations
http://blog.listincomprehension.com/search/label/procket
BSD 3-Clause "New" or "Revised" License
283 stars 80 forks source link

Allow passive mode #14

Closed jeanparpaillon closed 10 years ago

jeanparpaillon commented 10 years ago

Hi, Allowing a passive mode would be a great feature. Is there any plan to support it ?

Jean

msantos commented 10 years ago

On Tue, Jul 08, 2014 at 06:50:24AM -0700, Jean Parpaillon wrote:

Hi, Allowing a passive would be a great feature. Is there any plan to support it ?

Depending on the type of socket, you should be able to do something similar to passive reads right now. For tcp/udp sockets, it's simple (pass the fd into gen_tcp/gen_udp).

For other sockets types, you can try inert:

https://github.com/msantos/inert

inert is a driver that uses the erts event loop to poll the file descriptor and sends the process a message when the fd is ready.

inert is probably still a bit too "low level" compared to the inet passive mode. For example, the caller has to check still for {error, eagain} (it's possible for the event loop to return a ghost event).

Thanks for the feedback and let me know if any of this wasn't clear or if you have any suggestions!

jeanparpaillon commented 10 years ago

Thank you very much, inert makes the job !