[erlang-questions] Unix Domain Sockets in v19

Peter Lemenkov <>
Mon Oct 17 14:08:02 CEST 2016


Hello All!
I belive this wasn't standartized prior to documenting, so there might
be some discrepancies. Here is how I send arbitrary data to DGRAM
Unix-socket:

https://gist.github.com/lemenkov/22c4d621b432c3a27574facddd9862f8

{ok, UnixSock} = gen_udp:open(0, [local]),
gen_udp:send(UnixSock, {local, "/dev/log"}, 0, "HELLO").

it works fine.


2016-10-16 19:34 GMT+02:00 Taras Shapovalov <>:
> Hey guys,
>
> I would like to try the experimental feature of v19 -- unix sockets, but
> cannot get how it should be used. For example, if I send some request to
> docker with gen_udp, then I will get  {error,eprototype}:
>
> [ ~]$ erl
> Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10]
> [kernel-poll:false]
>
> Eshell V8.1  (abort with ^G)
> 1> {ok, Sockout} = gen_udp:open(0, [{ifaddr, {local, "/tmp/testsockout"}}]).
> {ok,#Port<0.413>}
> 2> gen_udp:send(Sockout, {local, "/var/run/docker.sock"}, 0,
> "http:/containers/json").
> {error,eprototype}
> 3>
>
> The socket is available and accessable by the user. Say, this works fine:
>
> curl --unix-socket /var/run/docker.sock http:/containers/json
>
> Any idea what is going wrong there?
>
> I will appreciate if someone points me to any documentation (I know the
> final description of the feature is not ready for now, but maybe there is
> some draft already exists?).
>
> Also do you know if httpc module supports the unix sockets since 19.0? If
> yes, how to do the same with httpc?
>
> Best regards,
>
> Taras
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>



-- 
With best regards, Peter Lemenkov.


More information about the erlang-questions mailing list