package riot

  1. Overview
  2. Docs
type 'kind socket
type listen_socket = [ `listen ] socket
type stream_socket = [ `stream ] socket
type listen_opts = {
  1. reuse_addr : bool;
  2. reuse_port : bool;
  3. backlog : int;
  4. addr : Addr.tcp_addr;
}
type timeout =
  1. | Infinity
  2. | Bounded of float
type unix_error = [
  1. | `Unix_error of Unix.error
]
type ('ok, 'err) result = ('ok, [> unix_error ] as 'err) result
val listen : ?opts:listen_opts -> port:int -> unit -> (listen_socket, [> `System_limit ]) result
val connect : Addr.stream_addr -> (stream_socket, [> `Closed ]) result
val accept : ?timeout:timeout -> listen_socket -> (stream_socket * Addr.stream_addr, [> `Closed | `Timeout | `System_limit ]) result
val close : _ socket -> unit
val controlling_process : _ socket -> new_owner:Pid.t -> (unit, [> `Closed | `Not_owner ]) result
val receive : ?timeout:timeout -> len:int -> stream_socket -> (Bigstringaf.t, [> `Closed | `Timeout ]) result
val send : Bigstringaf.t -> stream_socket -> (int, [> `Closed ]) result
val pp : Format.formatter -> _ socket -> unit
val pp_err : Format.formatter -> [ unix_error | `Closed | `Timeout | `System_limit ] -> unit
OCaml

Innovation. Community. Security.