GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ZMONITOR_V2 (3)

.ds Aq ’

NAME

zmonitor_v2 - socket event monitor (deprecated)

CONTENTS

SYNOPSIS

//  This code needs backporting to work with ZMQ v3.2
#if (ZMQ_VERSION_MAJOR == 4)

// Create a new socket monitor CZMQ_EXPORT zmonitor_t * zmonitor_new (zctx_t *ctx, void *socket, int events);

// Destroy a socket monitor CZMQ_EXPORT void zmonitor_destroy (zmonitor_t **self_p);

// Receive a status message from the monitor; if no message arrives within // 500 msec, or the call was interrupted, returns NULL. CZMQ_EXPORT zmsg_t * zmonitor_recv (zmonitor_t *self);

// Get the ZeroMQ socket, for polling CZMQ_EXPORT void * zmonitor_socket (zmonitor_t *self);

// Enable verbose tracing of commands and activity CZMQ_EXPORT void zmonitor_set_verbose (zmonitor_t *self, bool verbose); #endif // ZeroMQ 4.0 or later

// Self test of this class CZMQ_EXPORT void zmonitor_v2_test (bool verbose);

DESCRIPTION

The zmonitor class provides an API for obtaining socket events such as connected, listen, disconnected, etc. Socket events are only available for sockets connecting or bound to ipc:// and tcp:// endpoints. This class wraps the ZMQ socket monitor API, see zmq_socket_monitor for details. Currently this class requires libzmq v4.0 or later and is empty on older versions of libzmq.

This class is deprecated in CZMQ v3; it works together with zctx, zsocket, and other deprecated V2 classes. New applications should use the V3 zmonitor interface, based on zactor, together with the zsock class for sockets.

EXAMPLE

From zmonitor_v2_test method.

zctx_t *ctx = zctx_new ();
assert (ctx);
bool result;

void *sink = zsocket_new (ctx, ZMQ_PULL); assert (sink); zmonitor_t *sinkmon = zmonitor_new (ctx, sink, ZMQ_EVENT_LISTENING | ZMQ_EVENT_ACCEPTED); assert (sinkmon); zmonitor_set_verbose (sinkmon, verbose);

// Check sink is now listening int port_nbr = zsocket_bind (sink, "tcp://127.0.0.1:*"); assert (port_nbr != -1); result = s_check_event (sinkmon, ZMQ_EVENT_LISTENING); assert (result);

void *source = zsocket_new (ctx, ZMQ_PUSH); assert (source); zmonitor_t *sourcemon = zmonitor_new (ctx, source, ZMQ_EVENT_CONNECTED | ZMQ_EVENT_DISCONNECTED); assert (sourcemon); zmonitor_set_verbose (sourcemon, verbose); zsocket_connect (source, "tcp://127.0.0.1:%d", port_nbr);

// Check source connected to sink result = s_check_event (sourcemon, ZMQ_EVENT_CONNECTED); assert (result);

// Check sink accepted connection result = s_check_event (sinkmon, ZMQ_EVENT_ACCEPTED); assert (result);

zmonitor_destroy (&sinkmon); zmonitor_destroy (&sourcemon); zctx_destroy (&ctx);

AUTHORS

The czmq manual was written by the authors in the AUTHORS file.

RESOURCES

Main web site: \m[blue] \m[]

Report bugs to the email <\m[blue]zeromq-dev@lists.zeromq.org\m[][1]>

COPYRIGHT

Copyright (c) 1991-2012 iMatix Corporation -- http://www.imatix.com Copyright other contributors as noted in the AUTHORS file. This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. LICENSE included with the czmq distribution.

NOTES

1. zeromq-dev@lists.zeromq.org  mailto:zeromq-dev@lists.zeromq.org
Search for    or go to Top of page |  Section 3 |  Main Index


CZMQ 3&.0&.1 ZMONITOR_V2 (3) 06/01/2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.