From 77f71fc05cc4eb378de0a16df6390b3781d18d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Lid=C3=A9n?= Date: Thu, 6 Nov 2014 10:46:20 +0100 Subject: Update documentation for buffer options --- lib/kernel/doc/src/inet.xml | 61 +++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 24 deletions(-) (limited to 'lib/kernel') diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index 50e1cc290c..8dd311e5cd 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -138,7 +138,7 @@ fe80::204:acff:fe17:bf38 Return a list of IP configuration parameters -

Returns the state of the Inet configuration database in +

Returns the state of the Inet configuration database in form of a list of recorded configuration parameters. (See the ERTS User's Guide, Inet configuration, for more information). Only parameters with other than default values are returned.

@@ -258,8 +258,8 @@ fe80::204:acff:fe17:bf38 -

Gets one or more options for a socket. - See setopts/2 +

Gets one or more options for a socket. + See setopts/2 for a list of available options.

The number of elements in the returned OptionValues list does not necessarily correspond to the number of options @@ -278,14 +278,14 @@ fe80::204:acff:fe17:bf38 by the protocol level, the option number and either a binary or the size, in bytes, of the buffer in which the option value is to be stored. A binary - should be used when the underlying getsockopt requires + should be used when the underlying getsockopt requires input in the argument field, in which case the size of the binary should correspond to the required buffer size of the return value. The supplied values in a RawOptReq correspond to the second, third and fourth/fifth parameters to the getsockopt call in the C socket API. The value stored - in the buffer is returned as a binary ValueBin + in the buffer is returned as a binary ValueBin where all values are coded in the native endianess.

Asking for and inspecting raw socket options require low level information about the current operating system and TCP @@ -306,7 +306,7 @@ fe80::204:acff:fe17:bf38 value to be a 32 bit integer. We could use the following code to retrieve the value:

+ get_tcpi_sacked(Sock) -> {ok,[{raw,_,_,Info}]} = inet:getopts(Sock,[{raw,6,11,92}]), <<_:28/binary,TcpiSacked:32/native,_/binary>> = Info, TcpiSacked.]]> @@ -408,7 +408,7 @@ fe80::204:acff:fe17:bf38 Parse an IPv6 address strict. -

Parses an IPv6 address string and returns an ip6_address(). +

Parses an IPv6 address string and returns an ip6_address(). Does not accept IPv4 adresses.

@@ -613,15 +613,20 @@ fe80::204:acff:fe17:bf38 - {buffer, Size} + {buffer, Size} -

Determines the size of the user-level software buffer used by - the driver. Not to be confused with sndbuf - and recbuf options which correspond to - the kernel socket buffers. It is recommended - to have val(buffer) >= max(val(sndbuf),val(recbuf)). - In fact, the val(buffer) is automatically set to - the above maximum when sndbuf or recbuf values are set.

+

The size of the user-level software buffer used by + the driver. Not to be confused with sndbuf + and recbuf options which correspond to + the kernel socket buffers. It is recommended + to have val(buffer) >= max(val(sndbuf),val(recbuf)) to + avoid performance issues due to unnecessary copying. + In fact, the val(buffer) is automatically set to + the above maximum when sndbuf or recbuf values are set. + However, since the actual sizes set for sndbuf and recbuf + usually becomes larger, you are encouraged to use + inet:getopts/2 + to analyze the behavior of your operating system.

{delay_send, Boolean} @@ -998,8 +1003,12 @@ setcap cap_sys_admin,cap_sys_ptrace,cap_dac_read_search+epi beam.smp {recbuf, Size} -

Gives the size of the receive buffer to use for - the socket.

+

The minimum size of the receive buffer to use for + the socket. You are encouraged to use + inet:getopts/2, + to retrieve the actual size set by your operating system. + +

{reuseaddr, Boolean} @@ -1030,20 +1039,24 @@ setcap cap_sys_admin,cap_sys_ptrace,cap_dac_read_search+epi beam.smp {sndbuf, Size} -

Gives the size of the send buffer to use for the socket.

+

The minimum size of the send buffer to use for the socket. + You are encouraged to use + inet:getopts/2, + to retrieve the actual size set by your operating system. +

{priority, Integer} -

Sets the SO_PRIORITY socket level option on platforms where - this is implemented. The behaviour and allowed range varies on - different systems. The option is ignored on platforms where the +

Sets the SO_PRIORITY socket level option on platforms where + this is implemented. The behaviour and allowed range varies on + different systems. The option is ignored on platforms where the option is not implemented. Use with caution.

{tos, Integer} -

Sets IP_TOS IP level options on platforms where this is - implemented. The behaviour and allowed range varies on different - systems. The option is ignored on platforms where the option is +

Sets IP_TOS IP level options on platforms where this is + implemented. The behaviour and allowed range varies on different + systems. The option is ignored on platforms where the option is not implemented. Use with caution.

-- cgit v1.2.3