Inet bugs
Carlos
carlos@REDACTED
Wed Dec 12 18:02:11 CET 2001
I found two small errors in the Erlang/OTP R8B.
1) With the current inet module there are not support to multicast (UDP)
sockets because the UDP socket options "add_membership" and
"drop_membership"
are not included in the implementation of the inet module.
Solution: Instead of the function inet:udp_options/0 which current
implementation is:
udp_options() ->
[reuseaddr, sndbuf, recbuf, header, active, buffer, mode, deliver,
broadcast, dontroute, multicast_if, multicast_ttl, multicast_loop].
use the following function
udp_options() ->
[reuseaddr, sndbuf, recbuf, header, active, buffer, mode, deliver,
broadcast, dontroute, multicast_if, multicast_ttl, multicast_loop,
add_membership,drop_membership].
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This options should be documented.
2) The gen_udp:open(Port, Opts) function can receive a port number (integer)
or a service name (atom). When the Port argument is an atom, the service name is
translated to an integer (port number) using the getserv/1 function, but the
result of this function is not used in the last call of the gen_udp:open/2 function.
The original code is the following:
open(Port, Opts) ->
Mod = mod(Opts),
{ok,UP} = Mod:getserv(Port),
Mod:open(Port, Opts).
and the right code is,
open(Port, Opts) ->
Mod = mod(Opts),
{ok,UP} = Mod:getserv(Port),
Mod:open(UP, Opts).
^^^^
-- Carlos
More information about the erlang-questions
mailing list