@@ -1814,10 +1814,15 @@ returned.
18141814- ** ` raw | 0 ` ** - No packet handling is done. The entire binary is returned
18151815 unless it is empty.
18161816
1817- - ** ` 1 | 2 | 4 ` ** - Packets consist of a header specifying the number of bytes
1818- in the packet, followed by that number of bytes. The length of the header can
1819- be one, two, or four bytes; the order of the bytes is big-endian. The header
1820- is stripped off when the packet is returned.
1817+ - ** ` 1 | 2 | 3 | 4 ` ** - Packets consist of a header specifying the number of
1818+ bytes in the packet, followed by that number of bytes. The length of the
1819+ header can be one, two, three, or four bytes; the order of the bytes is
1820+ big-endian. The header is stripped off when the packet is returned.
1821+
1822+ - ** ` {N, Endian} ` ** - Uses the same framing with a two-, three-, or four-byte
1823+ header, in the byte order specified by ` Endian ` , which can be ` big ` , ` little ` ,
1824+ or ` native ` . ` {N, big} ` is equivalent to ` N ` ; ` native ` uses the native byte
1825+ order of the runtime system.
18211826
18221827- ** ` line ` ** - A packet is a line-terminated by a delimiter byte, default is the
18231828 latin-1 newline character. The delimiter byte is included in the returned
@@ -1890,8 +1895,10 @@ Options:
18901895 {ok , Packet , Rest } |
18911896 {more , Length } |
18921897 {error , Reason } when
1893- Type :: 'raw' | 0 | 1 | 2 | 4 | 'asn1' | 'cdr' | 'sunrm' | 'fcgi'
1894- | 'tpkt' | 'line' | 'http' | 'http_bin' | 'httph' | 'httph_bin' ,
1898+ Type :: 'raw' | 0 | 1 | 2 | 3 | 4
1899+ | {N :: 2 | 3 | 4 , Endian :: big | little | native }
1900+ | 'asn1' | 'cdr' | 'sunrm' | 'fcgi' | 'tpkt' | 'line'
1901+ | 'http' | 'http_bin' | 'httph' | 'httph_bin' ,
18951902 Bin :: binary (),
18961903 Options :: [Opt ],
18971904 Opt :: {packet_size , non_neg_integer ()}
@@ -7751,9 +7758,15 @@ encoding. For details, see the module `m:file`, the function
77517758follows:
77527759
77537760- **`{packet, N}`** - Messages are preceded by their length, sent in `N` bytes,
7754- with the most significant byte first. The valid values for `N` are 1, 2,
7761+ with the most significant byte first. The valid values for `N` are 1, 2, 3,
77557762 and 4.
77567763
7764+ - **`{packet, {N, Endian}}`** - Uses the same framing with a two-, three-, or
7765+ four-byte header, in the byte order specified by `Endian`, which can be
7766+ `big`, `little`, or `native`. This setting applies to messages in both
7767+ directions. `{packet, {N, big}}` is equivalent to `{packet, N}`; `native`
7768+ uses the native byte order of the runtime system.
7769+
77577770- **`stream`** - Output messages are sent without packet lengths. A user-defined
77587771 protocol must be used between the Erlang process and the external object.
77597772
@@ -7768,7 +7781,8 @@ follows:
77687781 following a newline sequence, the last line is also delivered with `Flag` set
77697782 to `noeol`. Otherwise lines are delivered with `Flag` set to `eol`.
77707783
7771- The `{packet, N}` and `{line, L}` settings are mutually exclusive.
7784+ The `{packet, N}` and `{packet, {N, Endian}}` settings are mutually exclusive
7785+ with `{line, L}`.
77727786
77737787- **`{cd, Dir}`** - Only valid for `{spawn, Command}` and
77747788 `{spawn_executable, FileName}`. The external program starts using `Dir` as its
@@ -7966,7 +7980,9 @@ by passing command-line flag [`+Q`](erl_cmd.md#max_ports) to [erl](erl_cmd.md).
79667980 {spawn_executable , FileName :: file :name_all () } |
79677981 {fd , In :: non_neg_integer (), Out :: non_neg_integer ()},
79687982 PortSettings :: [Opt ],
7969- Opt :: {packet , N :: 1 | 2 | 4 }
7983+ Opt :: {packet , N :: 1 | 2 | 3 | 4 }
7984+ | {packet , {N :: 2 | 3 | 4 ,
7985+ Endian :: big | little | native }}
79707986 | stream
79717987 | {line , L :: non_neg_integer ()}
79727988 | {cd , Dir :: string () | binary ()}
0 commit comments