<div dir="ltr"><div>Hi Raimo,</div><div><br></div><div>I don't mind small changes in the API if changes will be indicated in the release notes.</div><div>But I worry about other breaking changes or hidden bugs.</div><div>If anyone from the community is already using it in production it will be reassuring.</div><div><br></div><div>Thank you.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 12, 2020 at 4:00 PM Raimo Niskanen <<a href="mailto:raimo%2Berlang-questions@erlang.org">raimo+erlang-questions@erlang.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Pablo!<br>
<br>
We will still make backwards incompatible changes. But we do not know of<br>
any stability issues, and welcome all that stress test the code.<br>
<br>
So your code might stop working work in a future 23.X release.<br>
<br>
/ Raimo<br>
<br>
<br>
On Fri, Jun 12, 2020 at 01:48:32PM +0300, pablo platt wrote:<br>
> Hi,<br>
> <br>
> Is it safe to use the NIF socket module for UDP in production in OTP 23?<br>
> It's working in my tests but I'm not sure if it's considered unstable or if<br>
> I'm missing configuration or error handling.<br>
> <br>
> This is how I'm using it:<br>
> <br>
> open() -><br>
> {ok, Socket} = socket:open(inet, dgram, udp),<br>
> {ok, Port} = socket:bind(Socket, any),<br>
> {Socket, Port}.<br>
> <br>
> active_once(Socket) -><br>
> case socket:recvfrom(Socket, 0, [], nowait) of<br>
> {ok, {#{port := Port, addr := Addr}, Data}} -><br>
> {udp, Addr, Port, Data};<br>
> {select, {select_info, _SelectTag, SelectRef}} -><br>
> SelectRef;<br>
> {error, Reason} -><br>
> exit(Reason),<br>
> error<br>
> end.<br>
> <br>
> send(Socket, Addr, Port, Data) -><br>
> Dest = #{family => inet,<br>
> port => Port,<br>
> addr => Addr},<br>
> case socket:sendto(Socket, Data, Dest, [], nowait) of<br>
> ok -> ok;<br>
> {select, {select_info, _SelectTag, _SelectRef}} -><br>
> % need to wait for {'$socket', Socket, select, SelectRef} and<br>
> resend Data?<br>
> ok<br>
> end.<br>
> <br>
> close(Socket) -><br>
> socket:close(Socket).<br>
> <br>
> % listen for select ref<br>
> handle_info({'$socket', Socket, select, SelectRef}, _State) -><br>
> case socket:recvfrom(Socket, 0, [], nowait) of<br>
> {ok, {#{port := Port, addr := Addr}, Data}} -><br>
> % handle Data<br>
> ok;<br>
> {select, {select_info, _SelectTag, SelectRef}} -><br>
> SelectRef;<br>
> {error, Reason} -><br>
> exit(Reason),<br>
> error<br>
> end,<br>
> {noreply, State}.<br>
<br>
-- <br>
<br>
/ Raimo Niskanen, Erlang/OTP, Ericsson AB<br>
</blockquote></div>