package eio

  1. Overview
  2. Docs
Effect-based direct-style IO API for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

eio-1.4.tbz
sha256=ba11ad486f492130dbb486f2b3bdc4905643f10016806ddf86e9a34e4346aaa5
sha512=57ef2c137ccdc26d8029e636b6a4ee92da7c6b2f35954946bd56ca595d6947a8ec42f6f83f8552f73d6719e6ce2314cae2e2fad1686a387522935e6f90e9a8d9

doc/eio/Eio/Net/Sockopt/index.html

Module Net.SockoptSource

An extensible type for socket options. Portable options can be defined here, while platform-specific options can be added by backends.

  • since 1.4
Sourcetype _ t = ..
Sourceval pp : 'a t Fmt.t
Sourceval pp_binding : ('a t * 'a) Fmt.t

Common options

Sourcetype t +=
  1. | SO_DEBUG : bool t
    (*

    Enable socket debugging

    *)
  2. | SO_BROADCAST : bool t
    (*

    Permit sending of broadcast messages

    *)
  3. | SO_REUSEADDR : bool t
    (*

    Allow reuse of local addresses

    *)
  4. | SO_KEEPALIVE : bool t
    (*

    Keep TCP connection alive

    *)
  5. | SO_DONTROUTE : bool t
    (*

    Bypass routing tables

    *)
  6. | SO_OOBINLINE : bool t
    (*

    Leave out-of-band data in line

    *)
  7. | TCP_NODELAY : bool t
    (*

    Disable Nagle's algorithm

    *)
  8. | IPV6_ONLY : bool t
    (*

    Restrict to IPv6 only

    *)
  9. | SO_REUSEPORT : bool t
    (*

    Allow reuse of local port

    *)
  10. | SO_SNDBUF : int t
    (*

    Send buffer size

    *)
  11. | SO_RCVBUF : int t
    (*

    Receive buffer size

    *)
  12. | SO_RCVLOWAT : int t
    (*

    Receive low water mark

    *)
  13. | SO_SNDLOWAT : int t
    (*

    Send low water mark

    *)
  14. | SO_LINGER : int option t
    (*

    Linger on close if data present

    *)
  15. | SO_RCVTIMEO : float t
    (*

    Receive timeout

    *)
  16. | SO_SNDTIMEO : float t
    (*

    Send timeout

    *)
  17. | TCP_KEEPIDLE : int t
    (*

    Time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes. Available on FreeBSD, Linux, macOS, Windows.

    *)
  18. | TCP_KEEPINTVL : int t
    (*

    Interval (in seconds) between individual keepalive probes. Available on FreeBSD, Linux, macOS, Windows.

    *)
  19. | TCP_KEEPCNT : int t
    (*

    Maximum number of keepalive probes TCP should send before dropping the connection. Available on FreeBSD, Linux, macOS, Windows.

    *)
  20. | TCP_CONGESTION : string t
    (*

    Set the TCP congestion control algorithm to be used (e.g., "cubic", "reno"). Unprivileged processes are restricted to algorithms in tcp_allowed_congestion_control. Available on FreeBSD, Linux.

    *)

Linux-specific options

Sourcetype t +=
  1. | TCP_CORK : bool t
    (*

    When enabled, partial frames are not sent out. Data is only sent when the option is disabled or the buffer becomes full.

    *)
  2. | TCP_USER_TIMEOUT : int t
    (*

    Maximum time (in milliseconds) that transmitted data may remain unacknowledged before TCP will forcibly close the connection.

    *)
  3. | TCP_MAXSEG : int t
    (*

    The maximum segment size for outgoing TCP packets. If set before connection establishment, it also changes the MSS value announced to the other end.

    *)
  4. | TCP_LINGER2 : int option t
    (*

    Lifetime of orphaned FIN_WAIT2 sockets, in seconds.

    On set, None or Some 0 requests the system default; Some n with n >= 0 keeps orphaned sockets in FIN_WAIT2 for n seconds; negative values raise Invalid_argument.

    On get, Some n is the effective timeout and None means FIN_WAIT2 lingering has been disabled.

    *)
  5. | TCP_DEFER_ACCEPT : int t
    (*

    Allow a listener to be awakened only when data arrives on the socket. Value is the maximum time in seconds to wait for data.

    *)
  6. | TCP_SYNCNT : int t
    (*

    Set the number of SYN retransmits that TCP should send before aborting the attempt to connect. Cannot exceed 255.

    *)
  7. | TCP_WINDOW_CLAMP : int t
    (*

    Bound the size of the advertised window to this value. The kernel imposes a minimum size.

    *)
  8. | TCP_QUICKACK : bool t
    (*

    Enable quickack mode if set or disable if cleared. In quickack mode, acks are sent immediately rather than delayed. This flag is not permanent.

    *)
  9. | TCP_FASTOPEN : int t
    (*

    Enable Fast Open (RFC 7413) on the listener socket. The value specifies the maximum length of pending SYNs (similar to backlog in listen).

    *)
  10. | IP_FREEBIND : bool t
    (*

    Allow binding to an IP address that is nonlocal or does not (yet) exist. This permits listening on a socket without requiring the underlying network interface to be up.

    *)
  11. | IP_BIND_ADDRESS_NO_PORT : bool t
    (*

    Inform the kernel to not reserve an ephemeral port when using bind() with a port number of 0. The port will be chosen at connect() time.

    *)
  12. | IP_LOCAL_PORT_RANGE : (int * int) t
    (*

    Set the per-socket local port range as (lower_bound, upper_bound). Both bounds are inclusive and must be in range 0-65535. Use (0, 0) to reset to system defaults.

    *)
  13. | IP_TTL : int t
    (*

    Set or retrieve the time-to-live field used in every packet sent from this socket. Valid range is 1-255.

    *)
  14. | IP_MTU : int t
    (*

    Retrieve the current known path MTU of the current socket. Only valid for connected sockets. This is a read-only option.

    *)
  15. | IP_MTU_DISCOVER : [ `Want | `Dont | `Do | `Probe ] t
    (*

    Set or receive the Path MTU Discovery setting for a socket.

    • `Want: Use per-route settings (fragment if needed)
    • `Dont: Never do Path MTU Discovery
    • `Do: Always do Path MTU Discovery (reject large datagrams with EMSGSIZE)
    • `Probe: Set DF but ignore Path MTU (for diagnostic tools)
    *)

Registering printers (for backend use only)

Sourcetype printer_fn = {
  1. get : 'a. 'a t -> (string * 'a Fmt.t) option;
}
Sourceval register_printer : printer_fn -> unit

register_printer { get } adds get to the list of printers.

If called with an option it recognises, it should return the option's name and a printer for values of the appropriate type. If the option isn't known, return None.