- reuseaddr
- Allow servers to reuse a port without the system being completely sure the port is no longer in use.
- bindtodevice(+Device)
- Bind the socket to Device (an atom). For example, the code
below binds the socket to the loopback device that is typically
used to realise the localhost. See the manual pages for
setsockopt()
and the socket interface (e.g.,socket(7)
on Linux) for details.tcp_socket(Socket), tcp_setopt(Socket, bindtodevice(lo))
- nodelay
- nodelay(true)
- If
true
, disable the Nagle optimization on this socket, which is enabled by default on almost all modern TCP/IP stacks. The Nagle optimization joins small packages, which is generally desirable, but sometimes not. Please note that the underlying TCP_NODELAY setting tosetsockopt()
is not available on all platforms and systems may require additional privileges to change this option. If the option is not supported, tcp_setopt/2 raises a domain_error exception. See Wikipedia for details. - broadcast
- UDP sockets only: broadcast the package to all addresses matching the address. The address is normally the address of the local subnet (i.e. 192.168.1.255). See udp_send/4.
- ip_add_membership(+MultiCastGroup)
- ip_add_membership(+MultiCastGroup, +LocalInterface)
- ip_add_membership(+MultiCastGroup, +LocalInterface, +InterfaceIndex)
- ip_drop_membership(+MultiCastGroup)
- ip_drop_membership(+MultiCastGroup, +LocalInterface)
- ip_drop_membership(+MultiCastGroup, +LocalInterface, +InterfaceIndex)
- Join/leave a multicast group. Calls
setsockopt()
with the corresponding arguments. - dispatch(+Boolean)
- In GUI environments (using XPCE or the Windows
swipl-win.exe
executable) this flags defines whether or not any events are dispatched on behalf of the user interface. Default istrue
. Only very specific situations require setting this tofalse
. - sndbuf(+Integer)
- Sets the send buffer size to Integer (bytes). On Windows this defaults (now) to 64kb. Higher latency links may benefit from increasing this further since the maximum theoretical throughput on a link is given by buffer-size / latency. See https://support.microsoft.com/en-gb/help/823764/slow-performance-occurs-when-you-copy-data-to-a-tcp-server-by-using-a for Microsoft's discussion