[erlang-questions] connect to existing unix socket

Joe K goodjoe2049@REDACTED
Sun Nov 11 17:51:03 CET 2018


Sorry for my manners, forgot to say hi!

> On Nov 11, 2018, at 4:43 PM, Joe K <goodjoe2049@REDACTED> wrote:
> 
> tl;dr
> 
> How can I avoid:
> 
> ```
> 1> gen_udp:open(0, [binary, {ip, {local, <<"/home/vagrant/janus.sock">>}}]).
> {error,eaddrinuse}
> ```
> 
> ---
> 
> I have a janus gateway (https://github.com/meetecho/janus-gateway) running on the same host as my Erlang app and I want to be able to make them talk via a unix socket. Janus creates a SOCK_SEQPACKET or SOCK_DGRAM unix socket on startup and I want to be able to connect to it from Erlang. The problem is, when I set Janus to use SOCK_DGRAM, I can't then open it from Erlang:
> 
> ```
> 1> gen_udp:open(0, [binary, {ip, {local, <<"/home/vagrant/janus.sock">>}}]).
> {error,eaddrinuse}
> ```
> 
> and if I set Janus to use SOCK_SEQPACKET, gen_tcp fails for me as well:
> 
> ```
> 2> gen_tcp:connect({local, <<"/home/vagrant/janus.sock">>}, 0, [local]).
> {error,eprototype}
> ```
> 
> What am I doing wrong?




More information about the erlang-questions mailing list