package hvsock

  1. Overview
  2. Docs
type vmid =
  1. | Wildcard
    (*

    Any partition

    *)
  2. | Children
    (*

    Any child partition

    *)
  3. | Loopback
    (*

    The same partition

    *)
  4. | Parent
    (*

    The parent partition

    *)
  5. | Id of string
    (*

    A specific VM id

    *)
val string_of_vmid : vmid -> string
type sockaddr = {
  1. vmid : vmid;
    (*

    identifies a partition

    *)
  2. serviceid : string;
    (*

    identifies a service

    *)
}

An AF_HVSOCK socket address

val create : unit -> Unix.file_descr

create () creates an unbound AF_HVSOCK socket

val bind : Unix.file_descr -> sockaddr -> unit

bind socket sockaddr binds socket to sockaddr

val accept : Unix.file_descr -> Unix.file_descr * sockaddr

accept fd accepts a single connection

val connect : ?timeout_ms:int -> Unix.file_descr -> sockaddr -> unit

connect ?timeout_ms fd sockaddr connects to a remote partition. Since the raw socket call can block forever if the server is not running when the call is executed (even if the server starts up afterwards) there is a default timeout of 300ms. On timeout this will raise Unix_error(Unix.ETIMEDOUT)

OCaml

Innovation. Community. Security.