diff options
author | Ingela Anderton Andin <[email protected]> | 2019-06-17 12:01:19 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2019-06-17 12:01:19 +0200 |
commit | 15730c1e4554db25edee0be783dc5cd68c389c82 (patch) | |
tree | 0db3fd9571797978a42f02da8663a5be2cf535da /lib/kernel/src/inet_udp.erl | |
parent | 60d3e4ed3f616f7d28ba8dbf176ecfcd1524a62a (diff) | |
parent | d156b2cdceb8b2150522ba6c5ecca8734738e55e (diff) | |
download | otp-15730c1e4554db25edee0be783dc5cd68c389c82.tar.gz otp-15730c1e4554db25edee0be783dc5cd68c389c82.tar.bz2 otp-15730c1e4554db25edee0be783dc5cd68c389c82.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/kernel/src/inet_udp.erl')
-rw-r--r-- | lib/kernel/src/inet_udp.erl | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/kernel/src/inet_udp.erl b/lib/kernel/src/inet_udp.erl index 1e624b9e90..083059a2dc 100644 --- a/lib/kernel/src/inet_udp.erl +++ b/lib/kernel/src/inet_udp.erl @@ -66,16 +66,25 @@ open(Port, Opts) -> {ok, _} -> exit(badarg) end. -send(S, {A,B,C,D} = Addr, P, Data) - when ?ip(A,B,C,D), ?port(P) -> - prim_inet:sendto(S, Addr, P, Data). +send(S, {A,B,C,D} = IP, Port, Data) + when ?ip(A,B,C,D), ?port(Port) -> + prim_inet:sendto(S, {IP, Port}, [], Data); +send(S, {{A,B,C,D}, Port} = Addr, AncData, Data) + when ?ip(A,B,C,D), ?port(Port), is_list(AncData) -> + prim_inet:sendto(S, Addr, AncData, Data); +send(S, {?FAMILY, {{A,B,C,D}, Port}} = Address, AncData, Data) + when ?ip(A,B,C,D), ?port(Port), is_list(AncData) -> + prim_inet:sendto(S, Address, AncData, Data); +send(S, {?FAMILY, {loopback, Port}} = Address, AncData, Data) + when ?port(Port), is_list(AncData) -> + prim_inet:sendto(S, Address, AncData, Data). send(S, Data) -> - prim_inet:sendto(S, {0,0,0,0}, 0, Data). + prim_inet:sendto(S, {any, 0}, [], Data). -connect(S, Addr = {A,B,C,D}, P) - when ?ip(A,B,C,D), ?port(P) -> - prim_inet:connect(S, Addr, P). +connect(S, Addr = {A,B,C,D}, Port) + when ?ip(A,B,C,D), ?port(Port) -> + prim_inet:connect(S, Addr, Port). recv(S, Len) -> prim_inet:recvfrom(S, Len). |