[erlang-questions] clarify: gen_udp Set outbound ip address

mog mogorman@REDACTED
Tue Nov 13 05:14:25 CET 2007


Sorry If my question was not clearer.  Although IP_RECVDSTADDR is
something erlang should also support as I will often use multiple
interfaces.
However this was not the problem I was refering to.   When I send a
message with gen_udp:send it is received at the end point as the Local
Address it was sent out on.

gen_udp:open(Port, [binary, {active, false}, {reuseaddr, true}, {ip,
Addr}, {add_membership, {Addr, LAddr}}]).

Where Addr is my multicast Ip, LAddr is my network ip, so sent messages
are received as 192.168.1.50 instead of 224.0.1.185.

Mog

On Mon, 2007-11-12 at 22:42 -0500, Serge Aleynikov wrote:
> Though I haven't tried this with multicast packets, I suppose it would 
> work the same way as when a host has multiple interfaces and there's a 
> need for an inbound UDP packet to contain the ip address of the 
> interface it was received on.  This information is usually delivered as 
> ancillary data (IP_RECVDSTADDR sockopt), however Erlang's inet driver 
> doesn't support this feature.
> 
> Serge
> 
> mog wrote:
> > Hi I am looking for a way to set the outbound ip address on udp packets.
> > After the recent thread about multicast I started playing with it, and
> > have it working great.  I am able to receive on the multicast address
> > however sending out messages with gen_udp:send are received as the local
> > ip of the interface, not as the multicast address.  Is there a way to
> > enable this behavior?
> > 
> > Mog
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071112/28bedb28/attachment.bin>


More information about the erlang-questions mailing list