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

Per Hedeland per@REDACTED
Tue Nov 13 08:51:52 CET 2007


mog <mogorman@REDACTED> wrote:
>
>Sorry If my question was not clearer.  Although IP_RECVDSTADDR is
>something erlang should also support as I will often use multiple
>interfaces.

Well, that is OS-specific too unfortunately, the inferior/conventional
method is to use multiple sockets, each bound to one of the addresses
(assuming you do need to care about the address that is, you can of
course use multiple interfaces w/o doing that).

>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.

Hm, I'm afraid I still can't parse the "message received as address"
part:-) - are you referring to the source address of the multicast
packets you send out? If so, why would you expect it to be anything
other than the unicast address of the sender? Sending packets with a
multicast source address should be almost as bad as sending with a
broadcast source address, and such packets will probably be dropped by
most receiving stacks.

--Per Hedeland



More information about the erlang-questions mailing list