[erlang-questions] connect to existing unix socket

Joe K goodjoe2049@REDACTED
Sun Nov 11 18:01:45 CET 2018


If I start Janus with SOCK_DGRAM and use the following from Erlang

1> {ok, Sock} = gen_udp:open(0, [local]).
{ok,#Port<0.6>}
2> gen_udp:send(Sock, {local, <<"/home/vagrant/janus.sock">>}, 0, "{}").
ok
then I see 

Unix Sockets thread started
[WARN] Dropping packet from unknown source (no path provided)
in Janus logs.

> 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?

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


More information about the erlang-questions mailing list