[erlang-questions] async_accept

Steve Vinoski vinoski@REDACTED
Thu Feb 6 13:28:29 CET 2014


On Thu, Feb 6, 2014 at 5:35 AM, Sean Cribbs <sean@REDACTED> wrote:

> Does anyone know offhand what is the meaning of integer returned in the
> {ok, _} return value of prim_inet:async_accept/2? It's not documented
> clearly.
>

It's essentially a reference, but it's generated from a counter internal to
the inet driver so it's not an actual Erlang reference. It's the value of
the 3rd element of the inet_async message you get when a connection
arrives, allowing you to match those messages with the async_accept calls
that caused them: For example:

1> prim_inet:async_accept(L,-1).
{ok,3}
2> flush().
{inet_async,#Port<0.586>,3,{ok,#Port<0.587>}}

The value 3 here is the reference.

--steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140206/743611ac/attachment.htm>


More information about the erlang-questions mailing list