17 #ifndef ZMQPP_SOCKET_HPP_ 18 #define ZMQPP_SOCKET_HPP_ 43 #if (ZMQ_VERSION_MAJOR >= 4) 57 const int all = ZMQ_EVENT_ALL;
80 #if (ZMQ_VERSION_MAJOR == 2) 81 dont_wait = ZMQ_NOBLOCK,
83 dont_wait = ZMQ_DONTWAIT,
85 send_more = ZMQ_SNDMORE,
86 #ifdef ZMQ_EXPERIMENTAL_LABELS 87 send_label = ZMQ_SNDLABEL
117 void bind(endpoint_t
const& endpoint);
119 #if (ZMQ_VERSION_MAJOR > 3) || ((ZMQ_VERSION_MAJOR == 3) && (ZMQ_VERSION_MINOR >= 2)) 125 void unbind(endpoint_t
const& endpoint);
138 void connect(endpoint_t
const& endpoint);
153 template<
typename InputIterator>
154 void connect(InputIterator
const& connections_begin, InputIterator
const& connections_end)
156 for(InputIterator it = connections_begin; it != connections_end; ++it)
168 #if (ZMQ_VERSION_MAJOR > 3) || ((ZMQ_VERSION_MAJOR == 3) && (ZMQ_VERSION_MINOR >= 2)) 169 void disconnect(endpoint_t
const& endpoint);
179 template<
typename InputIterator>
180 void disconnect(InputIterator
const& disconnections_begin, InputIterator
const& disconnections_end)
182 for(InputIterator it = disconnections_begin; it != disconnections_end; ++it)
207 bool send(message_t&
message,
bool const dont_block =
false);
221 bool receive(message_t& message,
bool const dont_block =
false);
235 bool send(std::string
const&
string,
bool const dont_block =
false);
249 bool receive(std::string&
string,
bool const dont_block =
false);
263 bool send(
signal sig,
bool dont_block =
false);
277 bool receive(
signal &sig,
bool dont_block =
false);
292 bool send(std::string
const&
string,
int const flags);
307 bool receive(std::string&
string,
int const flags);
322 bool send_raw(
char const* buffer,
size_t const length,
int const flags = normal);
341 bool receive_raw(
char* buffer,
size_t& length,
int const flags = normal);
356 void subscribe(std::string
const& topic);
376 template<
typename InputIterator>
377 void subscribe(InputIterator
const& topics_begin, InputIterator
const& topics_end)
379 for(InputIterator it = topics_begin; it != topics_end; ++it)
397 void unsubscribe(std::string
const& topic);
417 template<
typename InputIterator>
418 void unsubscribe(InputIterator
const& topics_begin, InputIterator
const& topics_end)
420 for(InputIterator it = topics_begin; it != topics_end; ++it)
433 bool has_more_parts()
const;
476 void set(
socket_option const option,
char const* value,
size_t const length);
484 inline void set(
socket_option const option,
char const* value) {
set(option, value, strlen(value)); }
492 inline void set(
socket_option const option, std::string
const value) {
set(option, value.c_str(), value.length()); }
532 void get(
socket_option const option, std::string& value)
const;
541 template<
typename Type>
549 #if (ZMQ_VERSION_MAJOR >= 4) 558 void monitor(endpoint_t
const monitor_endpoint,
int events_required);
610 operator bool()
const;
617 operator void*()
const;
628 void track_message(message_t
const&, uint32_t
const,
bool&);
const int connected
Definition: socket.hpp:46
context context_t
context type
Definition: socket.hpp:40
#define ZMQPP_DEPRECATED(reason)
Definition: compatibility.hpp:118
const int all
Definition: socket.hpp:57
#define ZMQPP_EXPLICITLY_DELETED
Definition: compatibility.hpp:107
void * _socket
Definition: socket.hpp:620
C++ wrapper around zmq.
Definition: actor.cpp:29
void unsubscribe(InputIterator const &topics_begin, InputIterator const &topics_end)
Unsubscribe from a topic.
Definition: socket.hpp:418
zmq_msg_t _recv_buffer
Definition: socket.hpp:622
The socket class represents the zmq sockets.
Definition: socket.hpp:75
void connect(InputIterator const &connections_begin, InputIterator const &connections_end)
Asynchronously connects to multiple endpoints.
Definition: socket.hpp:154
const int connect_retried
Definition: socket.hpp:48
socket_type type() const
Get the type of the socket, this works on zmqpp types and not the zmq internal types.
Definition: socket.hpp:110
const int connect_delayed
Definition: socket.hpp:47
const int closed
Definition: socket.hpp:53
ZMQPP_COMPARABLE_ENUM socket_option
possible Socket options in zmq
Definition: socket_options.hpp:28
#define NOEXCEPT
Definition: compatibility.hpp:122
const int close_failed
Definition: socket.hpp:54
message message_t
message type
Definition: socket.hpp:41
void subscribe(InputIterator const &topics_begin, InputIterator const &topics_end)
Subscribe to a topic.
Definition: socket.hpp:377
The context class represents internal zmq context and io threads.
Definition: context.hpp:46
socket_type _type
Definition: socket.hpp:621
a zmq message with optional multipart support
Definition: message.hpp:43
std::string endpoint_t
endpoint type
Definition: socket.hpp:37
#define ZMQPP_EXPORT
Definition: compatibility.hpp:39
const int monitor_stopped
Definition: socket.hpp:56
signal
Signal is a 8 bytes integer.
Definition: signal.hpp:24
ZMQPP_COMPARABLE_ENUM socket_type
Socket types allowed by zmq.
Definition: socket_types.hpp:30
void disconnect(InputIterator const &disconnections_begin, InputIterator const &disconnections_end)
Disconnects from multiple previously connected endpoints.
Definition: socket.hpp:180
const int bind_failed
Definition: socket.hpp:50
const int accept_failed
Definition: socket.hpp:52
const int listening
Definition: socket.hpp:49
const int accepted
Definition: socket.hpp:51
const int disconnected
Definition: socket.hpp:55