table of contents
other versions
- jessie 2.2.0+dfsg-6
ZMQ_CPP(7) | 0MQ Manual | ZMQ_CPP(7) |
NAME¶
zmq_cpp - interface between 0MQ and C++ applicationsSYNOPSIS¶
#include <zmq.hpp> c++ [flags] files -lzmq [libraries]DESCRIPTION¶
This manual page describes how the 0MQ C++ language binding maps to the underlying 0MQ C library functions. All 0MQ constants defined by zmq.h are also available to the C++ language binding. The following classes are provided in the zmq namespace:Context¶
The context_t class encapsulates functionality dealing with the initialisation and termination of a 0MQ context.context_t::context_t(int io_threads)
context_t::~context_t(void)
None.
Socket¶
The socket_t class encapsulates a 0MQ socket.socket_t::socket_t(context_t &context, int type)
socket_t::~socket_t(void)
void socket_t::getsockopt(int option_name, void *option_value, size_t *option_len)
void socket_t::setsockopt(int option_name, const void *option_value, size_t option_len)
void socket_t::bind(const char *endpoint)
void socket_t::connect(const char *endpoint)
bool socket_t::send(message_t &msg, int flags = 0)
bool socket_t::recv(message_t *msg, int flags = 0)
Message¶
The zmq::message_t class encapsulates the zmq_msg_t structure and functions to construct, destruct and manipulate 0MQ messages.message_t::message_t(void) message_t::message_t(size_t size) message_t::message_t(void *data, size_t size, free_fn *ffn)
message_t::~message_t(void)
void *message_t::data (void)
size_t message_t::size (void)
void message_t::copy (message_t *src)
void message_t::move (message_t *src)
message_t::rebuild(void) message_t::rebuild(size_t size) message_t::rebuild(void *data, size_t size, free_fn *ffn)
Input/output multiplexing¶
int poll (zmq_pollitem_t *items, int nitems, long timeout = -1)
ERROR HANDLING¶
All errors reported by the underlying 0MQ C library functions are automatically converted to exceptions by the C++ language binding. The zmq::error_t class is derived from the std::exception class and uses the zmq_strerror() function to convert the error code to human-readable string.EXAMPLE¶
zmq::context_t ctx (1); zmq::socket_t s (ctx, ZMQ_PUB); s.connect ("tcp://192.168.0.115:5555"); zmq::message_t msg (100); memset (msg.data (), 0, 100); s.send (msg);
SEE ALSO¶
zmq(7)AUTHORS¶
This manual page was written by the 0MQ community.04/04/2012 | 0MQ 2.2.0 |