problem with new socket module setopt()
Mark Geib
mark.geib.44@REDACTED
Thu Jan 28 21:18:55 CET 2021
Adding socket:setopt(Socket, otp, debug, true) did not seem to have any effect. I captured a snippet from the log below which may help.
2021-01-28T09:08:04.897919-08:00 [error] Supervisor: {local,ptc_6254_A_transport_sup}. Context: start_error. Reason: {badarg,[{prim_socket,nif_setopt,[#Ref<0.2135233317.2669019137.87142>,true,303,3002,#{interface => {172,24,4,30},multiaddr => {239,33,62,54},sourceaddr => {172,24,93,7}}],[]},{cse_socket,open_ssm_mc,
4,[{file,"/home/geib/git/cse.mpeg.invidi.pts_delta/apps/ipd/src/cse_socket.erl"},{line,87}]},{mpeg_ingest_rtp,init,1,[{file,"/home/geib/git/cse.mpeg.invidi.pts_delta/apps/ipd/src/mpeg_ingest_rtp.erl"},{line,49}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,417}]},{gen_server,init_it,6,[{file,"gen_server.er
l"},{line,385}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}. Offender: id=ptc_6254_A,pid=undefined.
Mark.
> On Jan 28, 2021, at 10:27 AM, Micael Karlberg <micael.karlberg@REDACTED> wrote:
>
> Before the call to the setopt, add a call to socket:setopt(Socket, otp, debug, true).
>
> /BMK
>
>
> From: erlang-questions on behalf of Mark Geib
> Sent: Thursday, January 28, 2021 6:24 PM
> To: Erlang Questions
> Subject: problem with new socket module setopt()
>
> I am using the new socket module in order to join a source-specific multicast and receive datagrams. The following code fails with a “badarg” error on the socket:setopt() call. I have carefully checked the docs for R23, but can not find the problem.
>
> {ok, GroupAddr} = inet:getaddr(Group, inet),
> {ok, SourceAddr} = inet:getaddr(Source, inet),
> {ok, IfAddr} = inet:getaddr(Interface, inet),
> IpMreqSource = #{multiaddr => GroupAddr,
> interface => IfAddr,
> sourceaddr => SourceAddr},
>
> {ok, Socket} = socket:open(inet, dgram, udp),
> {ok, Port} = socket:bind(Socket, #{family => inet, port => Port, addr => GroupAddr}),
> ok = socket:setopt(Socket, ip, add_source_membership, IpMreqSource),
>
> I am using Erlang R23, latest release on debian-9 host.
> Any suggestions would be appreciated greatly.
>
> Mark.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210128/00472556/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 528 bytes
Desc: Message signed with OpenPGP
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210128/00472556/attachment.bin>
More information about the erlang-questions
mailing list