[erlang-questions] Erlang 19.3 crashes when getting sockname of stdin
Lukas Larsson
lukas@REDACTED
Mon Oct 16 17:51:06 CEST 2017
Hello,
On Mon, Oct 16, 2017 at 3:18 PM, Danil Zagoskin <z@REDACTED> wrote:
>
> Before calling inet:sockname on a port first make sure it's inet_tcp or
> inet_udp.
> For example,
> [{inet:sockname(P), erlang:port_info(P, connected)} || P <-
> erlang:ports(), erlang:port_get_data(P) == inet_tcp].
>
> You also can filter by name from erlang:port_info/1:
> [{inet:sockname(P), erlang:port_info(P, connected)} || P <-
> erlang:ports(), erlang:port_info(P, name) == {name,"tcp_inet"}].
>
>
Note that even this approach is not future proof as it assumes that tcp
connection are ports. Something which we are planning to change in the
future.
Lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171016/9aef126e/attachment.htm>
More information about the erlang-questions
mailing list