[erlang-questions] Unix Domain Sockets in v19

Vans S vans_163@REDACTED
Mon Oct 17 02:27:22 CEST 2016


    {ok, Socket} = gen_tcp:connect({local, <<"/tmp/unix_socket">>}, 0, [{active, true}, binary], 10000),
    ok = gen_tcp:send(Socket, <<"Hello to socket">>)),

use as regular socket now. Same thing for listening.  Listening will fail if a file exists with same name as the unix_socket. 

    On Sunday, October 16, 2016 1:35 PM, Taras Shapovalov <shapovalovts@REDACTED> wrote:
 

 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}:

[taras@REDACTED ~]$ 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
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161017/c9d6c500/attachment.htm>


More information about the erlang-questions mailing list