Class ZMQ::Context
In: rbzmq.c
Parent: Object

ZeroMQ library context.

Methods

close   new   socket  

Public Class methods

Initializes a new 0MQ context. The io_threads argument specifies the size of the 0MQ thread pool to handle I/O operations. If your application is using only the inproc transport for you may set this to zero; otherwise, set it to at least one.

Public Instance methods

Terminates the 0MQ context. If there are no longer any sockets open within context at the time zmq_term() is called then context shall be shut down and all associated resources shall be released immediately.

Otherwise, the following applies:

  • The close() function shall return immediately.
  • Any blocking operations currently in progress on sockets open within context shall return immediately with an error code of ETERM.
  • With the exception of ZMQ::Socket#close(), any further operations on sockets open within context shall fail with an error code of ETERM.
  • The actual shutdown of context, and release of any associated resources, shall be delayed until the last socket within it is closed with ZMQ::Socket#close().

Creates a new 0MQ socket. The socket_type argument specifies the socket type, which determines the semantics of communication over the socket.

The newly created socket is initially unbound, and not associated with any endpoints. In order to establish a message flow a socket must first be connected to at least one endpoint with connect(), or at least one endpoint must be created for accepting incoming connections with bind().

For a description of the various socket types, see ZMQ::Socket.

[Validate]