package tezos-base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type addr =
  1. | Unix of string
  2. | Tcp of string * string * Unix.getaddrinfo_option list
val connect : ?timeout:Ptime.Span.t -> addr -> Lwt_unix.file_descr Tezos_error_monad.Error_monad.tzresult Lwt.t

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.

OCaml

Innovation. Community. Security.