LoginSignup
0
0

More than 5 years have passed since last update.

elixir で Unix Domain Socket を読み書きする

Last updated at Posted at 2017-02-28

Elixir で Unix Domain Socket

自分用メモ

Elixir から Unix Domain Socketを作ったり送ったりするには
erlangのgen_udpをそのままいじればよい。

iex
{:ok,socket}= :gen_udp.open(0, [{:ifaddr, {:local, "/tmp/testsockin"}}])
:gen_udp.send(socket,{:local, "/tmp/testsockin"}, 0, "test test \r\n")
receive do
tmp ->
  IO.inspect tmp
after 3000 ->
  IO.puts "time out"
end

送るのにも同じソケットを使ってしまっているけどもこれは本来的には別のsocketを作って送るべきなんだろうな。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0