[erlang-questions] Erlang Latency Guide

Rapsey rapsey@REDACTED
Thu Nov 19 21:45:04 CET 2009


>From my testing {active,false} is the least optimal. I did those tests more
than a year ago, perhaps something changed since then, but probably not.


Sergej

On Thu, Nov 19, 2009 at 9:36 PM, Dmitry Vasiliev <dima@REDACTED> wrote:

> Erik Rigtorp wrote:
>
>> For receiving there is a simple solution to this problem: use the {active,
>> once} socket option.
>>
>> A simple selective receive-free TCP receiver:
>>
>> loop(Sock) ->
>>    inet:setopts(Sock, [{active, once}]),
>>    receive
>>        {tcp, Sock, Data} ->
>>            loop(Sock);
>>        {tcp_error, Sock, Reason} ->
>>            exit(Reason);
>>        {tcp_closed, Sock} ->
>>            exit()
>>    end.
>>
>
> Does it mean {active, once} more optimal than {active, false}?
>
> --
> Dmitry Vasiliev <dima at hlabs.spb.ru>
> http://hlabs.spb.ru
> http://twitter.com/hdima
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list