Module Os.Socket

Socket operations.

module Endpoint : sig ... end


val of_endpoint : Endpoint.t -> Unix.socket_type -> (Unix.sockaddr option * Unix.file_descr * bool, string) Stdlib.result

socket_of_endpoint e st is Ok (addr, fd, close) with:

  • addr, the address for the socket, if any.
  • fd, the file descriptor for the socket. If c is `Fd fd this is fd untouched. Otherwise fd is a new file descriptor set to non-blocking mode and has close on exec set to true.
  • close is true if the caller is in charge of closing it. This is false iff c is `Fd _.