package riot

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

Innovation. Community. Security.