<div dir="ltr">I don't think I can use `gen_udp:recv` on port returned in `<span style="font-size:12.800000190734863px">ssl:transport_accept(</span><wbr style="font-size:12.800000190734863px"><span style="font-size:12.800000190734863px">ListenSocket)` </span><span style="font-size:12.800000190734863px">(sorry for elixir terms):</span><div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">  </span>{:ok,</div><div>   {:sslsocket,</div><div>    {:gen_udp, {#PID<0.118.0>, {{{127, 0, 0, 1}, 54052}, #Port<0.1764>}},</div><div>     :dtls_connection}, #PID<0.143.0>}}</div></div><div><br></div><div>With elixir (`port` is the `#Port<...>` from above)</div><div><br></div><div>  :get_udp.recv(port, 0)</div><div><br></div><div>returns `{:error, :einval}`</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 28, 2017 at 3:26 PM, Joe K <span dir="ltr"><<a href="mailto:goodjoe2049@gmail.com" target="_blank">goodjoe2049@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Oops, I forgot to reply to the mailing list in my last email.<div><br></div><div>The response was</div><div><br></div><div><span class=""><span class="m_989778015935790503gmail-im" style="font-size:12.800000190734863px">  > Maybe browser sends STUN requests to your port when you expect DTLS hello?</span></span><span class=""><div style="font-size:12.800000190734863px">  You are absolutely right, Wireshark shows that there are lots of STUN binding requests being made, I didn't think of that.</div></span><span class="m_989778015935790503gmail-im" style="font-size:12.800000190734863px"><div><br></div><span class=""><div>  > Do you use external STUN server?</div></span></span><span class=""><div style="font-size:12.800000190734863px">  I don't use external STUN servers ... For some reason, I didn't think I would need them.</div></span><span class="m_989778015935790503gmail-im" style="font-size:12.800000190734863px"><div><br></div><span class=""><div>  > Also try checking <a style="font-family:"Times New Roman";font-size:medium">chrome://webrtc-inter<wbr>nals and </a><a style="font-family:"Times New Roman";font-size:medium">chrome://webrtc-logs for browser's view on what's going on.</a></div></span></span><span class=""><div style="font-size:12.800000190734863px"><a style="font-family:"Times New Roman";font-size:medium"></a><a>  chrome://webrtc-logs is empty for the webrtc whole session.</a></div></span></div><div style="font-size:12.800000190734863px"><a><br></a></div><div style="font-size:12.800000190734863px"><a>But now I don't know how to reply to both STUN binding request and then setup a DTLS session using erlang's ssl module.</a></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Dec 28, 2017 at 1:28 AM, Danil Zagoskin <span dir="ltr"><<a href="mailto:z@gosk.in" target="_blank">z@gosk.in</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi!<div>What do you see in Wireshark?</div><div>Did you see handshake between two browsers?</div><div>Is your application ready to receive the packet sent by browser?</div><div>Do you use external STUN server?</div><div>Maybe browser sends STUN requests to your port when you expect DTLS hello?</div><div><br></div><div>Also try checking <a style="font-family:"Times New Roman";font-size:medium">chrome://webrtc-inter<wbr>nals and </a><a style="font-family:"Times New Roman";font-size:medium">chrome://webrtc-logs for browser's view on what's going on.</a></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_989778015935790503h5">On Thu, Dec 28, 2017 at 12:09 AM, Joe K <span dir="ltr"><<a href="mailto:goodjoe2049@gmail.com" target="_blank">goodjoe2049@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_989778015935790503h5"><div dir="ltr">I'm trying to implement parts of webrtc stack with elixir/erlang and currently am stuck with setting up a dtls session.<div><br></div><div>The minimal example is, I think, the following (in console, erlang 20.2.2):</div><div><br></div><div><div>    2> ssl:start().</div><div>    ok</div><div>    3> {ok, ListenSocket} = ssl:listen(8090, [</div><div>    3>   binary,</div><div>    3>   {ip, {0, 0, 0, 0}},</div><div>    3>   {protocol, dtls},</div><div>    3>   {keyfile, <<"priv/server.key">>},</div><div>    3>   {certfile, <<"priv/server.pem">>},</div><div>    3>   {active, false}</div><div>    3> ]).</div><div>    {ok, ...}</div><div>    4> {ok, AcceptSocket} = ssl:transport_accept(ListenSoc<wbr>ket).</div><div>    {ok,...}</div><div>    5> ssl:ssl_accept(AcceptSocket).</div><div>    {error,{tls_alert,"record overflow"}}</div></div><div><br></div><div>And js (with chrome canary): <a href="https://gist.github.com/idi-ot/a07b7330ff02f90373a2dcfe83883afa" target="_blank">https://gist.github.c<wbr>om/idi-ot/a07b7330ff02f90373a2<wbr>dcfe83883afa</a></div><div><br></div><div>After {error,{tls_alert,"record overflow"}} the RTCPeerConnection's iceConnectionState becomes "failed" and the connection itself "closed".</div><div><br></div><div>I wonder what I am doing wrong.</div><div><br></div><div>    openssl s_client -dtls1 -connect <a href="http://127.0.0.1:8089" target="_blank">127.0.0.1:8089</a> -debug</div><div><br></div><div>works fine with the code snippet above.</div></div>
<br></div></div>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a><br>
<br></blockquote></div><span class="m_989778015935790503HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_989778015935790503m_1384859398565547069gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font face="'courier new', monospace">Danil Zagoskin | <a href="mailto:z@gosk.in" target="_blank">z@gosk.in</a></font></div></div></div>
</font></span></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div>