package octez-libs

  1. Overview
  2. Docs
type addr =
  1. | Unix of string
  2. | Tcp of string * string * Unix.getaddrinfo_option list

connect ?timeout addr tries connecting to addr and returns the resulting socket file descriptor on success. When using TCP, Unix.getaddrinfo is used to resolve the hostname and service (port). The different socket addresses returned by Unix.getaddrinfo are tried sequentially, and the ?timeout argument (default: 5s) governs how long it waits to get a connection. If a connection is not obtained in less than ?timeout, the connection is canceled and and the next socket address (if it exists) is tried.

handshake socket magic_bytes is a function to synchronize two separate processes and start a communication.

The scenario of the handshake is the following:

  • both processes simultaneously send some magic_bytes,
  • both processes wait and checks the received bytes validity,
  • handshake is finished.
val get_temporary_socket_dir : unit -> string

get_temporary_socket_dir () returns a temporary path for the socket to be spawned. $XDG_RUNTIME_DIR is returned if the environment variable is defined. Otherwise, the default temporary directory is used.

OCaml

Innovation. Community. Security.