problem with new socket module setopt()
Mark Geib <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <[email protected]> |
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.
signature.asc
(application/pgp-signature, 528 B)
-----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQEzBAEBCAAdFiEEYVHNuqOGsZElnxbO+5z0iCyWfG4FAmAS80cACgkQ+5z0iCyW fG4mDQgAiV9+b63WfSabrF9Wd8W7mzcPOWwRBhdGWyLQnSQMK12ikKvkvwMCcGDY d4HM0ZXrSrX1gVgSl0pfDrHURzI+zaK3xVJ3cavbo/x1A8LN/U3zuGpTB/iKJrLm wwWuWQvYiKs0RuJWVtHHFNCHzUBh3yIWC2dOI0qEpDhhkg35jra5pvISA9URrx/x Yb0CrB6IoEU0/MmYohjNyu5iRVXfHONxOVM18+a+82z1EMFX8IhL1uxak5lsXgBw wiSW698AwcXv1GcKktcAQR39uvyo+acTzpw1Nn0bznWD4fhCBxF6/mst9lAnSDPD /isN41Q0LtN4IB6vxnBu6bsQwiNxXw== =baKc -----END PGP SIGNATURE-----