The 4-byte header is limited to 2Gb.
- -
These packet types only have effect on receiving.
When sending a packet, it is the responsibility of
@@ -1450,6 +1450,7 @@ setcap cap_sys_admin,cap_sys_ptrace,cap_dac_read_search+epi beam.smp
- cdr - CORBA (GIOP 1.1)
- fcgi - Fast CGI
- tpkt - TPKT format [RFC1006]
+ - mqtt - MQTT packet [mqtt-v5.0] / [mqtt-v3.1.1]
- line - Line mode, a packet is a line-terminated
with newline, lines longer than the receive buffer are
truncated
diff --git a/lib/kernel/src/gen_tcp.erl b/lib/kernel/src/gen_tcp.erl
index a272d779e162..896c4a2eed73 100644
--- a/lib/kernel/src/gen_tcp.erl
+++ b/lib/kernel/src/gen_tcp.erl
@@ -56,7 +56,8 @@
{nodelay, boolean()} |
{packet,
0 | 1 | 2 | 4 | raw | sunrm | asn1 |
- cdr | fcgi | line | tpkt | http | httph | http_bin | httph_bin } |
+ cdr | fcgi | line | tpkt | http | httph | http_bin | httph_bin |
+ mqtt } |
{packet_size, non_neg_integer()} |
{priority, non_neg_integer()} |
{raw,
diff --git a/lib/kernel/src/gen_tcp_socket.erl b/lib/kernel/src/gen_tcp_socket.erl
index 38be596b4495..8bcda8524465 100644
--- a/lib/kernel/src/gen_tcp_socket.erl
+++ b/lib/kernel/src/gen_tcp_socket.erl
@@ -1637,7 +1637,8 @@ module_socket(#params{socket = Socket}) ->
%% -type packet_option_value() ::
%% 0 | 1 | 2 | 4 | raw | sunrm | asn1 |
-%% cdr | fcgi | line | tpkt | http | httph | http_bin | httph_bin.
+%% cdr | fcgi | line | tpkt | mqtt | http | httph | http_bin |
+%% httph_bin.
-compile({inline, [is_packet_option_value/1]}).
is_packet_option_value(Value) ->
@@ -1650,6 +1651,7 @@ is_packet_option_value(Value) ->
fcgi -> true;
line -> true;
tpkt -> true;
+ mqtt -> true;
http -> true;
httph -> true;
http_bin -> true;
diff --git a/lib/kernel/src/inet_int.hrl b/lib/kernel/src/inet_int.hrl
index 2f50f2c23cbd..2dcceabb3743 100644
--- a/lib/kernel/src/inet_int.hrl
+++ b/lib/kernel/src/inet_int.hrl
@@ -212,6 +212,7 @@
-define(TCP_PB_SSL_TLS, 12).
-define(TCP_PB_HTTP_BIN,13).
-define(TCP_PB_HTTPH_BIN,14).
+-define(TCP_PB_MQTT, 15).
%% getstat, INET_REQ_GETSTAT