summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/kernel/src/gen_tcp.erl2
-rw-r--r--lib/kernel/src/inet.erl5
-rw-r--r--lib/kernel/src/inet6_udp.erl6
-rw-r--r--lib/kernel/src/inet_udp.erl6
4 files changed, 10 insertions, 9 deletions
diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl
index 0c98f62cdf..b44144d88a 100644
--- a/lib/kernel/src/gen_tcp.erl
+++ b/lib/kernel/src/gen_tcp.erl
@@ -130,7 +130,7 @@
{netns, file:filename_all()} |
{bind_to_device, binary()} |
option().
--type socket() :: port().
+-type socket() :: inet:socket().
-export_type([option/0, option_name/0, connect_option/0, listen_option/0,
socket/0, pktoptions_value/0]).
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index 8b944a1049..6ae5351652 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -128,7 +128,8 @@
'etimedout' |
'ewouldblock' |
'exbadport' | 'exbadseq' | file:posix().
--type socket() :: port().
+-type module_socket() :: {'$inet', Handler :: module(), Handle :: term()}.
+-type socket() :: port() | module_socket().
-type socket_setopt() ::
gen_sctp:option() | gen_tcp:option() | gen_udp:option().
@@ -1433,7 +1434,7 @@ gethostbyaddr_tm_native(Addr, Timer, Opts) ->
Family :: address_family(),
Type :: socket_type(),
Module :: atom()) ->
- {'ok', socket()} | {'error', posix()}.
+ {'ok', port()} | {'error', posix()}.
open(FdO, Addr, Port, Opts, Protocol, Family, Type, Module)
when is_integer(FdO), FdO < 0;
diff --git a/lib/kernel/src/inet6_udp.erl b/lib/kernel/src/inet6_udp.erl
index 7ebdb3d301..b8c33e91ec 100644
--- a/lib/kernel/src/inet6_udp.erl
+++ b/lib/kernel/src/inet6_udp.erl
@@ -44,10 +44,10 @@ getaddr(Address, Timer) -> inet:getaddr(Address, ?FAMILY, Timer).
%% inet_udp special this side addresses
translate_ip(IP) -> inet:translate_ip(IP, ?FAMILY).
--spec open(_) -> {ok, inet:socket()} | {error, atom()}.
+-spec open(_) -> {ok, port()} | {error, atom()}.
open(Port) -> open(Port, []).
--spec open(_, _) -> {ok, inet:socket()} | {error, atom()}.
+-spec open(_, _) -> {ok, port()} | {error, atom()}.
open(Port, Opts) ->
case inet:udp_options(
[{port,Port} | Opts],
@@ -91,7 +91,7 @@ recv(S, Len) ->
recv(S, Len, Time) ->
prim_inet:recvfrom(S, Len, Time).
--spec close(inet:socket()) -> ok.
+-spec close(port()) -> ok.
close(S) ->
inet:udp_close(S).
diff --git a/lib/kernel/src/inet_udp.erl b/lib/kernel/src/inet_udp.erl
index ace095f30c..00ebd4bb1d 100644
--- a/lib/kernel/src/inet_udp.erl
+++ b/lib/kernel/src/inet_udp.erl
@@ -45,10 +45,10 @@ getaddr(Address, Timer) -> inet:getaddr(Address, ?FAMILY, Timer).
%% inet_udp special this side addresses
translate_ip(IP) -> inet:translate_ip(IP, ?FAMILY).
--spec open(_) -> {ok, inet:socket()} | {error, atom()}.
+-spec open(_) -> {ok, port()} | {error, atom()}.
open(Port) -> open(Port, []).
--spec open(_, _) -> {ok, inet:socket()} | {error, atom()}.
+-spec open(_, _) -> {ok, port()} | {error, atom()}.
open(Port, Opts) ->
case inet:udp_options(
[{port,Port}, {recbuf, ?RECBUF} | Opts],
@@ -92,7 +92,7 @@ recv(S, Len) ->
recv(S, Len, Time) ->
prim_inet:recvfrom(S, Len, Time).
--spec close(inet:socket()) -> ok.
+-spec close(port()) -> ok.
close(S) ->
inet:udp_close(S).