[erlang-questions] Local IP address in UDP packets
Fredrik Thulin
ft@REDACTED
Mon Oct 16 15:54:42 CEST 2006
Serge Aleynikov <serge@REDACTED> wrote:
...
>> - What is the real usecase when the option is needed? You explain
>> above, but why do you want/need to do like that?
>
> See above.
>
> We are planning to patch inet_drv.c for enabling this feature some
> time this or next week. If you are interested I can send you the
> patch.
I would just like to express my support for Serge's patch. In my project
(YXA SIP server), I have worked around this by doing what you (Kenneth)
offered as an alternative, have one UDP socket for every IP on the host
and use this socket for distinguishing to which IP a packet was sent,
and for sending packets using a specific source IP myself.
This has two disadvantages though,
1) figuring out which IP addresses a hosts network interfaces has
cannot be done with documented functions (no, I don't count os:cmd/1) -
you have to use the undocumented inet:getiflist/0 and inet:ifget/2.
2) If network interfaces are added, you have to poke the Erlang
application (YXA) to have it re-scan the network interfaces. This is
inferior to what the situation would be with Serge's patch.
/Fredrik
More information about the erlang-questions
mailing list