Module Zmq.Socket

type +'a t
type 'a kind
val pair : [ `Pair ] kind
val pub : [ `Pub ] kind
val sub : [ `Sub ] kind
val req : [ `Req ] kind
val rep : [ `Rep ] kind
val dealer : [ `Dealer ] kind
val router : [ `Router ] kind
val pull : [ `Pull ] kind
val push : [ `Push ] kind
val xsub : [ `Xsub ] kind
val xpub : [ `Xpub ] kind
val stream : [ `Stream ] kind
val create : Context.t -> 'a kind -> 'a t

Creation and Destruction

val close : 'a t -> unit
val connect : 'a t -> string -> unit

Wiring

val disconnect : 'a t -> string -> unit
val bind : 'a t -> string -> unit
val unbind : 'a t -> string -> unit
val recv : ?block:bool -> 'a t -> string

Read a message from the socket. block indicates if the call should be blocking or non-blocking. If block is false, recv will raise Unix.Unix_error (Unix.EAGAIN, _, _) if there are no messages available to receive on the specified socket. Default true

val recv_all : ?block:bool -> 'a t -> string list

Read a complete multipart message from the socket. block indicates if the call should be blocking or non-blocking. Default true

val send : ?block:bool -> ?more:bool -> 'a t -> string -> unit

Send a message to the socket. block indicates if the call should be blocking or non-blocking. Default true more is used for multipart messages, and indicates that the more message parts will follow. Default false

val send_all : ?block:bool -> 'a t -> string list -> unit

Send a multipart message to the socket. block indicates if the call should be blocking or non-blocking. Default true

val recv_msg : ?block:bool -> 'a t -> Msg.t

Receive a Msg.t on the socket.

  • parameter block

    indicates if the call should be blocking or non-blocking. Defaults to true.

val recv_msg_all : ?block:bool -> 'a t -> Msg.t list

Receive a multi-part message on the socket.

  • parameter block

    indicates if the call should be blocking or non-blocking. Defaults to true.

val send_msg : ?block:bool -> ?more:bool -> 'a t -> Msg.t -> unit

Send a Msg.t to the socket.

  • parameter block

    indicates if the call should be blocking or non-blocking. Defaults to true.

  • parameter more

    is used for multipart messages Set to true to indicate that more message parts will follow. Defaults to false.

val send_msg_all : ?block:bool -> 'a t -> Msg.t list -> unit

Send a multi-part message to the socket.

  • parameter block

    indicates if the call should be blocking or non-blocking. Defaults to true.

Option Getter and Setters

val set_max_message_size : 'a t -> int -> unit

Set the maximum message size of a message sent in this context, represented as a signed integer. A value of -1 will set the max message size to 2^64-1.

val get_max_message_size : 'a t -> int

Get the maximum message size for this context represented as a signed integer. A value of -1 equals to 2^64-1.

val set_affinity : 'a t -> int -> unit

Set thread affinity. Affinity is represented as a bit vector

val get_affinity : 'a t -> int

Get thread affinity, represented as a bit vector.

val set_identity : 'a t -> string -> unit
val get_identity : 'a t -> string
val subscribe : [< `Sub ] t -> string -> unit
val unsubscribe : [< `Sub ] t -> string -> unit
val get_last_endpoint : 'a t -> string
val set_tcp_accept_filter : 'a t -> string -> unit
val set_rate : 'a t -> int -> unit
val get_rate : 'a t -> int
val set_recovery_interval : 'a t -> int -> unit
val get_recovery_interval : 'a t -> int
val set_send_buffer_size : 'a t -> int -> unit
val get_send_buffer_size : 'a t -> int
val set_receive_buffer_size : 'a t -> int -> unit
val get_receive_buffer_size : 'a t -> int
val has_more : 'a t -> bool
val set_linger_period : 'a t -> int -> unit
val get_linger_period : 'a t -> int
val set_reconnect_interval : 'a t -> int -> unit
val get_reconnect_interval : 'a t -> int
val set_connection_backlog : 'a t -> int -> unit
val get_connection_backlog : 'a t -> int
val set_reconnect_interval_max : 'a t -> int -> unit
val get_reconnect_interval_max : 'a t -> int
val set_send_high_water_mark : 'a t -> int -> unit
val get_send_high_water_mark : 'a t -> int
val set_receive_high_water_mark : 'a t -> int -> unit
val get_receive_high_water_mark : 'a t -> int
val set_multicast_hops : 'a t -> int -> unit
val get_multicast_hops : 'a t -> int
val set_receive_timeout : 'a t -> int -> unit
val get_receive_timeout : 'a t -> int
val set_send_timeout : 'a t -> int -> unit
val get_send_timeout : 'a t -> int
val set_ipv6 : 'a t -> bool -> unit
val get_ipv6 : 'a t -> bool
val set_router_mandatory : [> `Router ] t -> bool -> unit
val get_router_mandatory : [> `Router ] t -> bool
val set_tcp_keepalive : 'a t -> [ `Default | `Value of bool ] -> unit
val get_tcp_keepalive : 'a t -> [ `Default | `Value of bool ]
val set_tcp_keepalive_idle : 'a t -> [ `Default | `Value of int ] -> unit
val get_tcp_keepalive_idle : 'a t -> [ `Default | `Value of int ]
val set_tcp_keepalive_count : 'a t -> [ `Default | `Value of int ] -> unit
val get_tcp_keepalive_count : 'a t -> [ `Default | `Value of int ]
val set_tcp_keepalive_interval : 'a t -> [ `Default | `Value of int ] -> unit
val get_tcp_keepalive_interval : 'a t -> [ `Default | `Value of int ]
val set_immediate : 'a t -> bool -> unit
val get_immediate : 'a t -> bool
val set_xpub_verbose : [< `Xpub ] t -> bool -> unit
val set_probe_router : [< `Router | `Dealer | `Req ] t -> bool -> unit
val set_req_correlate : [< `Req ] t -> bool -> unit
val set_req_relaxed : [< `Req ] t -> bool -> unit
val set_plain_server : 'a t -> bool -> unit
val set_plain_username : 'a t -> string -> unit
val get_plain_username : 'a t -> string
val set_plain_password : 'a t -> string -> unit
val get_plain_password : 'a t -> string
val set_curve_server : 'a t -> bool -> unit
val set_curve_publickey : 'a t -> string -> unit
val get_curve_publickey : 'a t -> string
val set_curve_secretkey : 'a t -> string -> unit
val get_curve_secretkey : 'a t -> string
val set_curve_serverkey : 'a t -> string -> unit
val get_curve_serverkey : 'a t -> string
val get_mechanism : 'a t -> [ `Null | `Plain | `Curve ]
val set_zap_domain : 'a t -> string -> unit
val get_zap_domain : 'a t -> string
val set_conflate : [< `Pull | `Push | `Sub | `Pub | `Dealer ] t -> bool -> unit
val set_stream_notify : [< `Stream ] t -> bool -> unit
val get_fd : 'a t -> Unix.file_descr
type event =
  1. | No_event
  2. | Poll_in
  3. | Poll_out
  4. | Poll_in_out
  5. | Poll_error
val events : 'a t -> event