DEV Community

voluntas
voluntas

Posted on • Edited on

1 3

gen_tcp で socket モジュールを利用する

OTP-23.0-rc2 で socket モジュールを利用した gen_tcp が使えるようになりました。
オプションで {inet_backend, socket} を指定するだけで使えるようになります。

Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V11.0  (abort with ^G)
1> gen_tcp:listen(5000, [{inet_backend, socket}]).
{ok,{'$inet',gen_tcp_socket,
             {<0.86.0>,{socket,#Ref<0.3988186683.781320197.173644>}}}}
2> gen_tcp:listen(5001, []).
{ok,#Port<0.5>}
Enter fullscreen mode Exit fullscreen mode

sys.config

{kernel, [{inet_backend, socket}]}
Enter fullscreen mode Exit fullscreen mode

こちらが正しい指定方法とのこと。

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay