rbczmq 1.6.2 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -3
- data/.gitmodules +6 -0
- data/.travis.yml +5 -1
- data/CHANGELOG.rdoc +15 -0
- data/Gemfile.lock +2 -2
- data/README.rdoc +5 -2
- data/Rakefile +8 -3
- data/ext/czmq/.gitignore +52 -0
- data/ext/czmq/.travis.yml +18 -0
- data/ext/czmq/AUTHORS +9 -0
- data/ext/czmq/COPYING +674 -0
- data/ext/czmq/COPYING.LESSER +178 -0
- data/ext/czmq/ChangeLog +0 -0
- data/ext/czmq/Makefile.am +22 -0
- data/ext/czmq/NEWS +263 -0
- data/ext/czmq/README +0 -0
- data/ext/czmq/README.md +1122 -0
- data/ext/czmq/README.txt +327 -0
- data/ext/czmq/autogen.sh +46 -0
- data/ext/czmq/builds/android/Android.mk +35 -0
- data/ext/czmq/builds/android/Application.mk +1 -0
- data/ext/czmq/builds/android/build.sh +59 -0
- data/ext/czmq/builds/android/clean.sh +26 -0
- data/ext/czmq/builds/mingw32/Makefile.mingw32 +38 -0
- data/ext/czmq/builds/mingw32/platform.h +0 -0
- data/ext/czmq/builds/msvc/.gitignore +18 -0
- data/ext/czmq/builds/msvc/README.txt +17 -0
- data/ext/czmq/builds/msvc/czmq.sln +69 -0
- data/ext/czmq/builds/msvc/czmq.vcproj +2246 -0
- data/ext/czmq/builds/msvc/czmq.vcxproj +329 -0
- data/ext/czmq/builds/msvc/czmq.vcxproj.filters +117 -0
- data/ext/czmq/builds/msvc/czmq11.sln +36 -0
- data/ext/czmq/builds/msvc/czmq_selftest.vcproj +840 -0
- data/ext/czmq/builds/msvc/czmq_selftest.vcxproj +189 -0
- data/ext/czmq/builds/msvc/czmq_selftest.vcxproj.filters +14 -0
- data/ext/czmq/c +520 -0
- data/ext/czmq/configure.ac +229 -0
- data/ext/czmq/doc/Makefile.am +49 -0
- data/ext/czmq/doc/asciidoc.conf +57 -0
- data/ext/czmq/doc/czmq.txt +334 -0
- data/ext/czmq/doc/mkman +100 -0
- data/ext/czmq/doc/mksite +65 -0
- data/ext/czmq/doc/wdput +43 -0
- data/ext/czmq/doc/xml2wd.pl +242 -0
- data/ext/czmq/doc/zbeacon.txt +173 -0
- data/ext/czmq/doc/zclock.txt +51 -0
- data/ext/czmq/doc/zconfig.txt +92 -0
- data/ext/czmq/doc/zctx.txt +111 -0
- data/ext/czmq/doc/zfile.txt +77 -0
- data/ext/czmq/doc/zframe.txt +222 -0
- data/ext/czmq/doc/zhash.txt +225 -0
- data/ext/czmq/doc/zlist.txt +176 -0
- data/ext/czmq/doc/zloop.txt +106 -0
- data/ext/czmq/doc/zmsg.txt +315 -0
- data/ext/czmq/doc/zmutex.txt +54 -0
- data/ext/czmq/doc/zsocket.txt +110 -0
- data/ext/czmq/doc/zsockopt.txt +528 -0
- data/ext/czmq/doc/zstr.txt +80 -0
- data/ext/czmq/doc/zsys.txt +44 -0
- data/ext/czmq/doc/zthread.txt +126 -0
- data/ext/czmq/doc/ztree.txt +236 -0
- data/ext/czmq/images/README_1.png +0 -0
- data/ext/czmq/images/README_2.png +0 -0
- data/ext/czmq/include/czmq.h +64 -0
- data/ext/czmq/include/czmq_prelude.h +504 -0
- data/ext/czmq/include/zbeacon.h +91 -0
- data/ext/czmq/include/zclock.h +56 -0
- data/ext/czmq/include/zconfig.h +117 -0
- data/ext/czmq/include/zctx.h +96 -0
- data/ext/czmq/include/zfile.h +82 -0
- data/ext/czmq/include/zframe.h +145 -0
- data/ext/czmq/include/zhash.h +127 -0
- data/ext/czmq/include/zlist.h +113 -0
- data/ext/czmq/include/zloop.h +98 -0
- data/ext/czmq/include/zmsg.h +165 -0
- data/ext/czmq/include/zmutex.h +62 -0
- data/ext/czmq/include/zsocket.h +104 -0
- data/ext/czmq/include/zsockopt.h +249 -0
- data/ext/czmq/include/zstr.h +69 -0
- data/ext/czmq/include/zsys.h +66 -0
- data/ext/czmq/include/zthread.h +62 -0
- data/ext/czmq/include/ztree.h +133 -0
- data/ext/czmq/mkdoc +14 -0
- data/ext/czmq/model/generate +2 -0
- data/ext/czmq/model/sockopts.xml +101 -0
- data/ext/czmq/notes.txt +21 -0
- data/ext/czmq/scripts/sockopts.gsl +325 -0
- data/ext/czmq/src/Makefile.am +61 -0
- data/ext/czmq/src/czmq_selftest.c +60 -0
- data/ext/czmq/src/libczmq.pc.in +11 -0
- data/ext/czmq/src/selftest +7 -0
- data/ext/czmq/src/selftest.cfg +5 -0
- data/ext/czmq/src/valgrind.supp +14 -0
- data/ext/czmq/src/vg +2 -0
- data/ext/czmq/src/zbeacon.c +787 -0
- data/ext/czmq/src/zclock.c +143 -0
- data/ext/czmq/src/zconfig.c +691 -0
- data/ext/czmq/src/zctx.c +287 -0
- data/ext/czmq/src/zfile.c +237 -0
- data/ext/czmq/src/zframe.c +551 -0
- data/ext/czmq/src/zhash.c +664 -0
- data/ext/czmq/src/zlist.c +459 -0
- data/ext/czmq/src/zloop.c +496 -0
- data/ext/czmq/src/zmsg.c +854 -0
- data/ext/czmq/src/zmutex.c +134 -0
- data/ext/czmq/src/zsocket.c +313 -0
- data/ext/czmq/src/zsockopt.c +1756 -0
- data/ext/czmq/src/zstr.c +297 -0
- data/ext/czmq/src/zsys.c +136 -0
- data/ext/czmq/src/zthread.c +269 -0
- data/ext/czmq/src/ztree.c +888 -0
- data/ext/czmq/version.sh +21 -0
- data/ext/rbczmq/extconf.rb +1 -18
- data/ext/rbczmq/poller.c +4 -1
- data/ext/rbczmq/socket.c +28 -5
- data/ext/rbczmq/socket.h +1 -0
- data/ext/zeromq/AUTHORS +110 -0
- data/ext/zeromq/CMakeLists.txt +392 -0
- data/ext/zeromq/COPYING +674 -0
- data/ext/zeromq/COPYING.LESSER +179 -0
- data/ext/zeromq/INSTALL +246 -0
- data/ext/zeromq/MAINTAINERS +56 -0
- data/ext/zeromq/Makefile.am +40 -0
- data/ext/zeromq/NEWS +333 -0
- data/ext/zeromq/README +39 -0
- data/ext/zeromq/acinclude.m4 +930 -0
- data/ext/zeromq/autogen.sh +45 -0
- data/ext/zeromq/branding.bmp +0 -0
- data/ext/zeromq/builds/msvc/Makefile.am +33 -0
- data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/errno.cpp +32 -0
- data/ext/zeromq/builds/msvc/errno.hpp +56 -0
- data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcproj +174 -0
- data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcxproj +86 -0
- data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcproj +174 -0
- data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcxproj +86 -0
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcproj +804 -0
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj +252 -0
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj.filters +431 -0
- data/ext/zeromq/builds/msvc/msvc.sln +89 -0
- data/ext/zeromq/builds/msvc/msvc10.sln +116 -0
- data/ext/zeromq/builds/msvc/platform.hpp +32 -0
- data/ext/zeromq/builds/msvc/properties/Common.props +21 -0
- data/ext/zeromq/builds/msvc/properties/Debug.props +19 -0
- data/ext/zeromq/builds/msvc/properties/Dynamic.props +20 -0
- data/ext/zeromq/builds/msvc/properties/Executable.props +19 -0
- data/ext/zeromq/builds/msvc/properties/Precompiled.props +14 -0
- data/ext/zeromq/builds/msvc/properties/Release.props +22 -0
- data/ext/zeromq/builds/msvc/properties/Win32.props +12 -0
- data/ext/zeromq/builds/msvc/properties/Win32_Release.props +17 -0
- data/ext/zeromq/builds/msvc/properties/WithOpenPGM.props +12 -0
- data/ext/zeromq/builds/msvc/properties/ZeroMQ.props +23 -0
- data/ext/zeromq/builds/msvc/properties/x64.props +12 -0
- data/ext/zeromq/builds/redhat/zeromq.spec.in +160 -0
- data/ext/zeromq/builds/valgrind/valgrind.supp +14 -0
- data/ext/zeromq/builds/valgrind/vg +1 -0
- data/ext/zeromq/cmake/Modules/TestZMQVersion.cmake +35 -0
- data/ext/zeromq/cmake/Modules/zmq_version.cpp +31 -0
- data/ext/zeromq/cmake/NSIS.template32.in +952 -0
- data/ext/zeromq/cmake/NSIS.template64.in +960 -0
- data/ext/zeromq/configure.in +428 -0
- data/ext/zeromq/doc/Makefile.am +51 -0
- data/ext/zeromq/doc/asciidoc.conf +56 -0
- data/ext/zeromq/doc/zmq.txt +233 -0
- data/ext/zeromq/doc/zmq_bind.txt +102 -0
- data/ext/zeromq/doc/zmq_close.txt +52 -0
- data/ext/zeromq/doc/zmq_connect.txt +98 -0
- data/ext/zeromq/doc/zmq_ctx_destroy.txt +66 -0
- data/ext/zeromq/doc/zmq_ctx_get.txt +67 -0
- data/ext/zeromq/doc/zmq_ctx_new.txt +49 -0
- data/ext/zeromq/doc/zmq_ctx_set.txt +75 -0
- data/ext/zeromq/doc/zmq_disconnect.txt +67 -0
- data/ext/zeromq/doc/zmq_epgm.txt +162 -0
- data/ext/zeromq/doc/zmq_errno.txt +50 -0
- data/ext/zeromq/doc/zmq_getsockopt.txt +516 -0
- data/ext/zeromq/doc/zmq_init.txt +52 -0
- data/ext/zeromq/doc/zmq_inproc.txt +85 -0
- data/ext/zeromq/doc/zmq_ipc.txt +85 -0
- data/ext/zeromq/doc/zmq_msg_close.txt +55 -0
- data/ext/zeromq/doc/zmq_msg_copy.txt +57 -0
- data/ext/zeromq/doc/zmq_msg_data.txt +48 -0
- data/ext/zeromq/doc/zmq_msg_get.txt +72 -0
- data/ext/zeromq/doc/zmq_msg_init.txt +65 -0
- data/ext/zeromq/doc/zmq_msg_init_data.txt +85 -0
- data/ext/zeromq/doc/zmq_msg_init_size.txt +58 -0
- data/ext/zeromq/doc/zmq_msg_more.txt +63 -0
- data/ext/zeromq/doc/zmq_msg_move.txt +52 -0
- data/ext/zeromq/doc/zmq_msg_recv.txt +125 -0
- data/ext/zeromq/doc/zmq_msg_send.txt +122 -0
- data/ext/zeromq/doc/zmq_msg_set.txt +45 -0
- data/ext/zeromq/doc/zmq_msg_size.txt +48 -0
- data/ext/zeromq/doc/zmq_pgm.txt +162 -0
- data/ext/zeromq/doc/zmq_poll.txt +132 -0
- data/ext/zeromq/doc/zmq_proxy.txt +97 -0
- data/ext/zeromq/doc/zmq_recv.txt +93 -0
- data/ext/zeromq/doc/zmq_recvmsg.txt +123 -0
- data/ext/zeromq/doc/zmq_send.txt +100 -0
- data/ext/zeromq/doc/zmq_sendmsg.txt +119 -0
- data/ext/zeromq/doc/zmq_setsockopt.txt +523 -0
- data/ext/zeromq/doc/zmq_socket.txt +369 -0
- data/ext/zeromq/doc/zmq_socket_monitor.txt +288 -0
- data/ext/zeromq/doc/zmq_strerror.txt +55 -0
- data/ext/zeromq/doc/zmq_tcp.txt +101 -0
- data/ext/zeromq/doc/zmq_term.txt +66 -0
- data/ext/zeromq/doc/zmq_unbind.txt +65 -0
- data/ext/zeromq/doc/zmq_version.txt +53 -0
- data/ext/zeromq/foreign/openpgm/Makefile.am +8 -0
- data/ext/zeromq/foreign/openpgm/libpgm-5.1.118~dfsg.tar.gz +0 -0
- data/ext/zeromq/include/zmq.h +402 -0
- data/ext/zeromq/include/zmq_utils.h +64 -0
- data/ext/zeromq/installer.ico +0 -0
- data/ext/zeromq/perf/Makefile.am +22 -0
- data/ext/zeromq/perf/inproc_lat.cpp +233 -0
- data/ext/zeromq/perf/inproc_thr.cpp +241 -0
- data/ext/zeromq/perf/local_lat.cpp +109 -0
- data/ext/zeromq/perf/local_thr.cpp +133 -0
- data/ext/zeromq/perf/remote_lat.cpp +122 -0
- data/ext/zeromq/perf/remote_thr.cpp +105 -0
- data/ext/zeromq/src/Makefile.am +171 -0
- data/ext/zeromq/src/address.cpp +78 -0
- data/ext/zeromq/src/address.hpp +52 -0
- data/ext/zeromq/src/array.hpp +155 -0
- data/ext/zeromq/src/atomic_counter.hpp +197 -0
- data/ext/zeromq/src/atomic_ptr.hpp +196 -0
- data/ext/zeromq/src/blob.hpp +129 -0
- data/ext/zeromq/src/clock.cpp +147 -0
- data/ext/zeromq/src/clock.hpp +60 -0
- data/ext/zeromq/src/command.hpp +154 -0
- data/ext/zeromq/src/config.hpp +89 -0
- data/ext/zeromq/src/ctx.cpp +352 -0
- data/ext/zeromq/src/ctx.hpp +173 -0
- data/ext/zeromq/src/dealer.cpp +133 -0
- data/ext/zeromq/src/dealer.hpp +92 -0
- data/ext/zeromq/src/decoder.cpp +166 -0
- data/ext/zeromq/src/decoder.hpp +248 -0
- data/ext/zeromq/src/devpoll.cpp +190 -0
- data/ext/zeromq/src/devpoll.hpp +105 -0
- data/ext/zeromq/src/dist.cpp +194 -0
- data/ext/zeromq/src/dist.hpp +105 -0
- data/ext/zeromq/src/encoder.cpp +102 -0
- data/ext/zeromq/src/encoder.hpp +200 -0
- data/ext/zeromq/src/epoll.cpp +178 -0
- data/ext/zeromq/src/epoll.hpp +101 -0
- data/ext/zeromq/src/err.cpp +291 -0
- data/ext/zeromq/src/err.hpp +155 -0
- data/ext/zeromq/src/fd.hpp +45 -0
- data/ext/zeromq/src/fq.cpp +141 -0
- data/ext/zeromq/src/fq.hpp +74 -0
- data/ext/zeromq/src/i_decoder.hpp +49 -0
- data/ext/zeromq/src/i_encoder.hpp +55 -0
- data/ext/zeromq/src/i_engine.hpp +55 -0
- data/ext/zeromq/src/i_msg_sink.hpp +43 -0
- data/ext/zeromq/src/i_msg_source.hpp +44 -0
- data/ext/zeromq/src/i_poll_events.hpp +47 -0
- data/ext/zeromq/src/io_object.cpp +108 -0
- data/ext/zeromq/src/io_object.hpp +81 -0
- data/ext/zeromq/src/io_thread.cpp +104 -0
- data/ext/zeromq/src/io_thread.hpp +91 -0
- data/ext/zeromq/src/ip.cpp +109 -0
- data/ext/zeromq/src/ip.hpp +41 -0
- data/ext/zeromq/src/ipc_address.cpp +84 -0
- data/ext/zeromq/src/ipc_address.hpp +67 -0
- data/ext/zeromq/src/ipc_connecter.cpp +265 -0
- data/ext/zeromq/src/ipc_connecter.hpp +128 -0
- data/ext/zeromq/src/ipc_listener.cpp +206 -0
- data/ext/zeromq/src/ipc_listener.hpp +99 -0
- data/ext/zeromq/src/kqueue.cpp +201 -0
- data/ext/zeromq/src/kqueue.hpp +107 -0
- data/ext/zeromq/src/lb.cpp +148 -0
- data/ext/zeromq/src/lb.hpp +73 -0
- data/ext/zeromq/src/libzmq.pc.in +10 -0
- data/ext/zeromq/src/likely.hpp +33 -0
- data/ext/zeromq/src/mailbox.cpp +87 -0
- data/ext/zeromq/src/mailbox.hpp +75 -0
- data/ext/zeromq/src/msg.cpp +299 -0
- data/ext/zeromq/src/msg.hpp +148 -0
- data/ext/zeromq/src/mtrie.cpp +428 -0
- data/ext/zeromq/src/mtrie.hpp +93 -0
- data/ext/zeromq/src/mutex.hpp +118 -0
- data/ext/zeromq/src/object.cpp +393 -0
- data/ext/zeromq/src/object.hpp +134 -0
- data/ext/zeromq/src/options.cpp +562 -0
- data/ext/zeromq/src/options.hpp +135 -0
- data/ext/zeromq/src/own.cpp +206 -0
- data/ext/zeromq/src/own.hpp +145 -0
- data/ext/zeromq/src/pair.cpp +136 -0
- data/ext/zeromq/src/pair.hpp +79 -0
- data/ext/zeromq/src/pgm_receiver.cpp +283 -0
- data/ext/zeromq/src/pgm_receiver.hpp +141 -0
- data/ext/zeromq/src/pgm_sender.cpp +218 -0
- data/ext/zeromq/src/pgm_sender.hpp +113 -0
- data/ext/zeromq/src/pgm_socket.cpp +706 -0
- data/ext/zeromq/src/pgm_socket.hpp +124 -0
- data/ext/zeromq/src/pipe.cpp +447 -0
- data/ext/zeromq/src/pipe.hpp +207 -0
- data/ext/zeromq/src/poll.cpp +176 -0
- data/ext/zeromq/src/poll.hpp +105 -0
- data/ext/zeromq/src/poller.hpp +82 -0
- data/ext/zeromq/src/poller_base.cpp +99 -0
- data/ext/zeromq/src/poller_base.hpp +86 -0
- data/ext/zeromq/src/precompiled.cpp +21 -0
- data/ext/zeromq/src/precompiled.hpp +47 -0
- data/ext/zeromq/src/proxy.cpp +150 -0
- data/ext/zeromq/src/proxy.hpp +32 -0
- data/ext/zeromq/src/pub.cpp +57 -0
- data/ext/zeromq/src/pub.hpp +69 -0
- data/ext/zeromq/src/pull.cpp +79 -0
- data/ext/zeromq/src/pull.hpp +81 -0
- data/ext/zeromq/src/push.cpp +76 -0
- data/ext/zeromq/src/push.hpp +80 -0
- data/ext/zeromq/src/random.cpp +52 -0
- data/ext/zeromq/src/random.hpp +37 -0
- data/ext/zeromq/src/reaper.cpp +117 -0
- data/ext/zeromq/src/reaper.hpp +80 -0
- data/ext/zeromq/src/rep.cpp +137 -0
- data/ext/zeromq/src/rep.hpp +80 -0
- data/ext/zeromq/src/req.cpp +185 -0
- data/ext/zeromq/src/req.hpp +91 -0
- data/ext/zeromq/src/router.cpp +364 -0
- data/ext/zeromq/src/router.hpp +138 -0
- data/ext/zeromq/src/select.cpp +216 -0
- data/ext/zeromq/src/select.hpp +126 -0
- data/ext/zeromq/src/session_base.cpp +503 -0
- data/ext/zeromq/src/session_base.hpp +156 -0
- data/ext/zeromq/src/signaler.cpp +406 -0
- data/ext/zeromq/src/signaler.hpp +63 -0
- data/ext/zeromq/src/socket_base.cpp +1236 -0
- data/ext/zeromq/src/socket_base.hpp +255 -0
- data/ext/zeromq/src/stdint.hpp +63 -0
- data/ext/zeromq/src/stream_engine.cpp +594 -0
- data/ext/zeromq/src/stream_engine.hpp +149 -0
- data/ext/zeromq/src/sub.cpp +93 -0
- data/ext/zeromq/src/sub.hpp +71 -0
- data/ext/zeromq/src/tcp.cpp +131 -0
- data/ext/zeromq/src/tcp.hpp +38 -0
- data/ext/zeromq/src/tcp_address.cpp +613 -0
- data/ext/zeromq/src/tcp_address.hpp +100 -0
- data/ext/zeromq/src/tcp_connecter.cpp +319 -0
- data/ext/zeromq/src/tcp_connecter.hpp +123 -0
- data/ext/zeromq/src/tcp_listener.cpp +293 -0
- data/ext/zeromq/src/tcp_listener.hpp +91 -0
- data/ext/zeromq/src/thread.cpp +107 -0
- data/ext/zeromq/src/thread.hpp +79 -0
- data/ext/zeromq/src/trie.cpp +337 -0
- data/ext/zeromq/src/trie.hpp +79 -0
- data/ext/zeromq/src/v1_decoder.cpp +162 -0
- data/ext/zeromq/src/v1_decoder.hpp +68 -0
- data/ext/zeromq/src/v1_encoder.cpp +103 -0
- data/ext/zeromq/src/v1_encoder.hpp +60 -0
- data/ext/zeromq/src/v1_protocol.hpp +43 -0
- data/ext/zeromq/src/version.rc.in +93 -0
- data/ext/zeromq/src/windows.hpp +181 -0
- data/ext/zeromq/src/wire.hpp +99 -0
- data/ext/zeromq/src/xpub.cpp +200 -0
- data/ext/zeromq/src/xpub.hpp +110 -0
- data/ext/zeromq/src/xsub.cpp +242 -0
- data/ext/zeromq/src/xsub.hpp +108 -0
- data/ext/zeromq/src/ypipe.hpp +210 -0
- data/ext/zeromq/src/yqueue.hpp +199 -0
- data/ext/zeromq/src/zmq.cpp +1058 -0
- data/ext/zeromq/src/zmq_utils.cpp +61 -0
- data/ext/zeromq/tests/Makefile.am +55 -0
- data/ext/zeromq/tests/test_connect_delay.cpp +260 -0
- data/ext/zeromq/tests/test_connect_resolve.cpp +54 -0
- data/ext/zeromq/tests/test_disconnect_inproc.cpp +120 -0
- data/ext/zeromq/tests/test_hwm.cpp +83 -0
- data/ext/zeromq/tests/test_invalid_rep.cpp +92 -0
- data/ext/zeromq/tests/test_last_endpoint.cpp +60 -0
- data/ext/zeromq/tests/test_monitor.cpp +289 -0
- data/ext/zeromq/tests/test_msg_flags.cpp +78 -0
- data/ext/zeromq/tests/test_pair_inproc.cpp +53 -0
- data/ext/zeromq/tests/test_pair_ipc.cpp +53 -0
- data/ext/zeromq/tests/test_pair_tcp.cpp +54 -0
- data/ext/zeromq/tests/test_reqrep_device.cpp +143 -0
- data/ext/zeromq/tests/test_reqrep_inproc.cpp +53 -0
- data/ext/zeromq/tests/test_reqrep_ipc.cpp +53 -0
- data/ext/zeromq/tests/test_reqrep_tcp.cpp +54 -0
- data/ext/zeromq/tests/test_router_mandatory.cpp +62 -0
- data/ext/zeromq/tests/test_shutdown_stress.cpp +93 -0
- data/ext/zeromq/tests/test_sub_forward.cpp +99 -0
- data/ext/zeromq/tests/test_term_endpoint.cpp +118 -0
- data/ext/zeromq/tests/test_timeo.cpp +119 -0
- data/ext/zeromq/tests/testutil.hpp +77 -0
- data/ext/zeromq/version.sh +21 -0
- data/lib/zmq/version.rb +1 -1
- data/rbczmq.gemspec +16 -3
- data/test/test_socket.rb +13 -1
- metadata +398 -9
- checksums.yaml +0 -15
- data/ext/czmq-1.4.1.tar.gz +0 -0
- data/ext/zeromq-3.2.3.tar.gz +0 -0
@@ -0,0 +1,369 @@
|
|
1
|
+
zmq_socket(3)
|
2
|
+
=============
|
3
|
+
|
4
|
+
|
5
|
+
NAME
|
6
|
+
----
|
7
|
+
zmq_socket - create 0MQ socket
|
8
|
+
|
9
|
+
|
10
|
+
SYNOPSIS
|
11
|
+
--------
|
12
|
+
*void *zmq_socket (void '*context', int 'type');*
|
13
|
+
|
14
|
+
|
15
|
+
DESCRIPTION
|
16
|
+
-----------
|
17
|
+
The 'zmq_socket()' function shall create a 0MQ socket within the specified
|
18
|
+
'context' and return an opaque handle to the newly created socket. The 'type'
|
19
|
+
argument specifies the socket type, which determines the semantics of
|
20
|
+
communication over the socket.
|
21
|
+
|
22
|
+
The newly created socket is initially unbound, and not associated with any
|
23
|
+
endpoints. In order to establish a message flow a socket must first be
|
24
|
+
connected to at least one endpoint with linkzmq:zmq_connect[3], or at least one
|
25
|
+
endpoint must be created for accepting incoming connections with
|
26
|
+
linkzmq:zmq_bind[3].
|
27
|
+
|
28
|
+
.Key differences to conventional sockets
|
29
|
+
Generally speaking, conventional sockets present a _synchronous_ interface to
|
30
|
+
either connection-oriented reliable byte streams (SOCK_STREAM), or
|
31
|
+
connection-less unreliable datagrams (SOCK_DGRAM). In comparison, 0MQ sockets
|
32
|
+
present an abstraction of an asynchronous _message queue_, with the exact
|
33
|
+
queueing semantics depending on the socket type in use. Where conventional
|
34
|
+
sockets transfer streams of bytes or discrete datagrams, 0MQ sockets transfer
|
35
|
+
discrete _messages_.
|
36
|
+
|
37
|
+
0MQ sockets being _asynchronous_ means that the timings of the physical
|
38
|
+
connection setup and tear down, reconnect and effective delivery are transparent
|
39
|
+
to the user and organized by 0MQ itself. Further, messages may be _queued_ in
|
40
|
+
the event that a peer is unavailable to receive them.
|
41
|
+
|
42
|
+
Conventional sockets allow only strict one-to-one (two peers), many-to-one
|
43
|
+
(many clients, one server), or in some cases one-to-many (multicast)
|
44
|
+
relationships. With the exception of 'ZMQ_PAIR', 0MQ sockets may be connected
|
45
|
+
*to multiple endpoints* using _zmq_connect()_, while simultaneously accepting
|
46
|
+
incoming connections *from multiple endpoints* bound to the socket using
|
47
|
+
_zmq_bind()_, thus allowing many-to-many relationships.
|
48
|
+
|
49
|
+
.Thread safety
|
50
|
+
0MQ 'sockets' are _not_ thread safe. Applications MUST NOT use a socket
|
51
|
+
from multiple threads except after migrating a socket from one thread to
|
52
|
+
another with a "full fence" memory barrier.
|
53
|
+
|
54
|
+
.Socket types
|
55
|
+
The following sections present the socket types defined by 0MQ, grouped by the
|
56
|
+
general _messaging pattern_ which is built from related socket types.
|
57
|
+
|
58
|
+
|
59
|
+
Request-reply pattern
|
60
|
+
~~~~~~~~~~~~~~~~~~~~~
|
61
|
+
The request-reply pattern is used for sending requests from a ZMQ_REQ _client_
|
62
|
+
to one or more ZMQ_REP _services_, and receiving subsequent replies to each
|
63
|
+
request sent.
|
64
|
+
|
65
|
+
|
66
|
+
ZMQ_REQ
|
67
|
+
^^^^^^^
|
68
|
+
A socket of type 'ZMQ_REQ' is used by a _client_ to send requests to and
|
69
|
+
receive replies from a _service_. This socket type allows only an alternating
|
70
|
+
sequence of _zmq_send(request)_ and subsequent _zmq_recv(reply)_ calls. Each
|
71
|
+
request sent is round-robined among all _services_, and each reply received is
|
72
|
+
matched with the last issued request.
|
73
|
+
|
74
|
+
When a 'ZMQ_REQ' socket enters the 'mute' state due to having reached the
|
75
|
+
high water mark for all _services_, or if there are no _services_ at all, then
|
76
|
+
any linkzmq:zmq_send[3] operations on the socket shall block until the
|
77
|
+
'mute' state ends or at least one _service_ becomes available for sending;
|
78
|
+
messages are not discarded.
|
79
|
+
|
80
|
+
[horizontal]
|
81
|
+
.Summary of ZMQ_REQ characteristics
|
82
|
+
Compatible peer sockets:: 'ZMQ_REP', 'ZMQ_ROUTER'
|
83
|
+
Direction:: Bidirectional
|
84
|
+
Send/receive pattern:: Send, Receive, Send, Receive, ...
|
85
|
+
Outgoing routing strategy:: Round-robin
|
86
|
+
Incoming routing strategy:: Last peer
|
87
|
+
Action in mute state:: Block
|
88
|
+
|
89
|
+
|
90
|
+
ZMQ_REP
|
91
|
+
^^^^^^^
|
92
|
+
A socket of type 'ZMQ_REP' is used by a _service_ to receive requests from and
|
93
|
+
send replies to a _client_. This socket type allows only an alternating
|
94
|
+
sequence of _zmq_recv(request)_ and subsequent _zmq_send(reply)_ calls. Each
|
95
|
+
request received is fair-queued from among all _clients_, and each reply sent
|
96
|
+
is routed to the _client_ that issued the last request. If the original
|
97
|
+
requester doesn't exist any more the reply is silently discarded.
|
98
|
+
|
99
|
+
When a 'ZMQ_REP' socket enters the 'mute' state due to having reached the
|
100
|
+
high water mark for a _client_, then any replies sent to the _client_ in
|
101
|
+
question shall be dropped until the mute state ends.
|
102
|
+
|
103
|
+
[horizontal]
|
104
|
+
.Summary of ZMQ_REP characteristics
|
105
|
+
Compatible peer sockets:: 'ZMQ_REQ', 'ZMQ_DEALER'
|
106
|
+
Direction:: Bidirectional
|
107
|
+
Send/receive pattern:: Receive, Send, Receive, Send, ...
|
108
|
+
Incoming routing strategy:: Fair-queued
|
109
|
+
Outgoing routing strategy:: Last peer
|
110
|
+
Action in mute state:: Drop
|
111
|
+
|
112
|
+
|
113
|
+
ZMQ_DEALER
|
114
|
+
^^^^^^^^^^
|
115
|
+
A socket of type 'ZMQ_DEALER' is an advanced pattern used for extending
|
116
|
+
request/reply sockets. Each message sent is round-robined among all connected
|
117
|
+
peers, and each message received is fair-queued from all connected peers.
|
118
|
+
|
119
|
+
When a 'ZMQ_DEALER' socket enters the 'mute' state due to having reached the
|
120
|
+
high water mark for all peers, or if there are no peers at all, then any
|
121
|
+
linkzmq:zmq_send[3] operations on the socket shall block until the mute
|
122
|
+
state ends or at least one peer becomes available for sending; messages are not
|
123
|
+
discarded.
|
124
|
+
|
125
|
+
When a 'ZMQ_DEALER' socket is connected to a 'ZMQ_REP' socket each message sent
|
126
|
+
must consist of an empty message part, the _delimiter_, followed by one or more
|
127
|
+
_body parts_.
|
128
|
+
|
129
|
+
Deprecated alias: 'ZMQ_XREQ'.
|
130
|
+
|
131
|
+
[horizontal]
|
132
|
+
.Summary of ZMQ_DEALER characteristics
|
133
|
+
Compatible peer sockets:: 'ZMQ_ROUTER', 'ZMQ_REP', 'ZMQ_DEALER'
|
134
|
+
Direction:: Bidirectional
|
135
|
+
Send/receive pattern:: Unrestricted
|
136
|
+
Outgoing routing strategy:: Round-robin
|
137
|
+
Incoming routing strategy:: Fair-queued
|
138
|
+
Action in mute state:: Block
|
139
|
+
|
140
|
+
|
141
|
+
ZMQ_ROUTER
|
142
|
+
^^^^^^^^^^
|
143
|
+
A socket of type 'ZMQ_ROUTER' is an advanced socket type used for extending
|
144
|
+
request/reply sockets. When receiving messages a 'ZMQ_ROUTER' socket shall
|
145
|
+
prepend a message part containing the _identity_ of the originating peer to the
|
146
|
+
message before passing it to the application. Messages received are fair-queued
|
147
|
+
from among all connected peers. When sending messages a 'ZMQ_ROUTER' socket shall
|
148
|
+
remove the first part of the message and use it to determine the _identity_ of
|
149
|
+
the peer the message shall be routed to. If the peer does not exist anymore
|
150
|
+
the message shall be silently discarded by default, unless 'ZMQ_ROUTER_BEHAVIOR'
|
151
|
+
socket option is set to '1'.
|
152
|
+
|
153
|
+
When a 'ZMQ_ROUTER' socket enters the 'mute' state due to having reached the
|
154
|
+
high water mark for all peers, then any messages sent to the socket shall be dropped
|
155
|
+
until the mute state ends. Likewise, any messages routed to a peer for which
|
156
|
+
the individual high water mark has been reached shall also be dropped.
|
157
|
+
|
158
|
+
When a 'ZMQ_REQ' socket is connected to a 'ZMQ_ROUTER' socket, in addition to the
|
159
|
+
_identity_ of the originating peer each message received shall contain an empty
|
160
|
+
_delimiter_ message part. Hence, the entire structure of each received message
|
161
|
+
as seen by the application becomes: one or more _identity_ parts, _delimiter_
|
162
|
+
part, one or more _body parts_. When sending replies to a 'ZMQ_REQ' socket the
|
163
|
+
application must include the _delimiter_ part.
|
164
|
+
|
165
|
+
Deprecated alias: 'ZMQ_XREP'.
|
166
|
+
|
167
|
+
[horizontal]
|
168
|
+
.Summary of ZMQ_ROUTER characteristics
|
169
|
+
Compatible peer sockets:: 'ZMQ_DEALER', 'ZMQ_REQ', 'ZMQ_ROUTER'
|
170
|
+
Direction:: Bidirectional
|
171
|
+
Send/receive pattern:: Unrestricted
|
172
|
+
Outgoing routing strategy:: See text
|
173
|
+
Incoming routing strategy:: Fair-queued
|
174
|
+
Action in mute state:: Drop
|
175
|
+
|
176
|
+
|
177
|
+
Publish-subscribe pattern
|
178
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
179
|
+
The publish-subscribe pattern is used for one-to-many distribution of data from
|
180
|
+
a single _publisher_ to multiple _subscribers_ in a fan out fashion.
|
181
|
+
|
182
|
+
|
183
|
+
ZMQ_PUB
|
184
|
+
^^^^^^^
|
185
|
+
A socket of type 'ZMQ_PUB' is used by a _publisher_ to distribute data.
|
186
|
+
Messages sent are distributed in a fan out fashion to all connected peers.
|
187
|
+
The linkzmq:zmq_recv[3] function is not implemented for this socket type.
|
188
|
+
|
189
|
+
When a 'ZMQ_PUB' socket enters the 'mute' state due to having reached the
|
190
|
+
high water mark for a _subscriber_, then any messages that would be sent to the
|
191
|
+
_subscriber_ in question shall instead be dropped until the mute state
|
192
|
+
ends. The _zmq_send()_ function shall never block for this socket type.
|
193
|
+
|
194
|
+
[horizontal]
|
195
|
+
.Summary of ZMQ_PUB characteristics
|
196
|
+
Compatible peer sockets:: 'ZMQ_SUB', 'ZMQ_XSUB'
|
197
|
+
Direction:: Unidirectional
|
198
|
+
Send/receive pattern:: Send only
|
199
|
+
Incoming routing strategy:: N/A
|
200
|
+
Outgoing routing strategy:: Fan out
|
201
|
+
Action in mute state:: Drop
|
202
|
+
|
203
|
+
|
204
|
+
ZMQ_SUB
|
205
|
+
^^^^^^^
|
206
|
+
A socket of type 'ZMQ_SUB' is used by a _subscriber_ to subscribe to data
|
207
|
+
distributed by a _publisher_. Initially a 'ZMQ_SUB' socket is not subscribed to
|
208
|
+
any messages, use the 'ZMQ_SUBSCRIBE' option of linkzmq:zmq_setsockopt[3] to
|
209
|
+
specify which messages to subscribe to. The _zmq_send()_ function is not
|
210
|
+
implemented for this socket type.
|
211
|
+
|
212
|
+
[horizontal]
|
213
|
+
.Summary of ZMQ_SUB characteristics
|
214
|
+
Compatible peer sockets:: 'ZMQ_PUB', 'ZMQ_XPUB'
|
215
|
+
Direction:: Unidirectional
|
216
|
+
Send/receive pattern:: Receive only
|
217
|
+
Incoming routing strategy:: Fair-queued
|
218
|
+
Outgoing routing strategy:: N/A
|
219
|
+
Action in mute state:: Drop
|
220
|
+
|
221
|
+
|
222
|
+
ZMQ_XPUB
|
223
|
+
^^^^^^^^
|
224
|
+
Same as ZMQ_PUB except that you can receive subscriptions from the peers
|
225
|
+
in form of incoming messages. Subscription message is a byte 1 (for
|
226
|
+
subscriptions) or byte 0 (for unsubscriptions) followed by the subscription
|
227
|
+
body.
|
228
|
+
|
229
|
+
[horizontal]
|
230
|
+
.Summary of ZMQ_XPUB characteristics
|
231
|
+
Compatible peer sockets:: 'ZMQ_SUB', 'ZMQ_XSUB'
|
232
|
+
Direction:: Unidirectional
|
233
|
+
Send/receive pattern:: Send messages, receive subscriptions
|
234
|
+
Incoming routing strategy:: N/A
|
235
|
+
Outgoing routing strategy:: Fan out
|
236
|
+
Action in mute state:: Drop
|
237
|
+
|
238
|
+
|
239
|
+
ZMQ_XSUB
|
240
|
+
^^^^^^^^
|
241
|
+
Same as ZMQ_SUB except that you subscribe by sending subscription messages to
|
242
|
+
the socket. Subscription message is a byte 1 (for subscriptions) or byte 0
|
243
|
+
(for unsubscriptions) followed by the subscription body.
|
244
|
+
|
245
|
+
[horizontal]
|
246
|
+
.Summary of ZMQ_XSUB characteristics
|
247
|
+
Compatible peer sockets:: 'ZMQ_PUB', 'ZMQ_XPUB'
|
248
|
+
Direction:: Unidirectional
|
249
|
+
Send/receive pattern:: Receive messages, send subscriptions
|
250
|
+
Incoming routing strategy:: Fair-queued
|
251
|
+
Outgoing routing strategy:: N/A
|
252
|
+
Action in mute state:: Drop
|
253
|
+
|
254
|
+
|
255
|
+
Pipeline pattern
|
256
|
+
~~~~~~~~~~~~~~~~
|
257
|
+
The pipeline pattern is used for distributing data to _nodes_ arranged in
|
258
|
+
a pipeline. Data always flows down the pipeline, and each stage of the pipeline
|
259
|
+
is connected to at least one _node_. When a pipeline stage is connected to
|
260
|
+
multiple _nodes_ data is round-robined among all connected _nodes_.
|
261
|
+
|
262
|
+
|
263
|
+
ZMQ_PUSH
|
264
|
+
^^^^^^^^
|
265
|
+
A socket of type 'ZMQ_PUSH' is used by a pipeline _node_ to send messages
|
266
|
+
to downstream pipeline _nodes_. Messages are round-robined to all connected
|
267
|
+
downstream _nodes_. The _zmq_recv()_ function is not implemented for this
|
268
|
+
socket type.
|
269
|
+
|
270
|
+
When a 'ZMQ_PUSH' socket enters the 'mute' state due to having reached the
|
271
|
+
high water mark for all downstream _nodes_, or if there are no downstream
|
272
|
+
_nodes_ at all, then any linkzmq:zmq_send[3] operations on the socket shall
|
273
|
+
block until the mute state ends or at least one downstream _node_
|
274
|
+
becomes available for sending; messages are not discarded.
|
275
|
+
|
276
|
+
[horizontal]
|
277
|
+
.Summary of ZMQ_PUSH characteristics
|
278
|
+
Compatible peer sockets:: 'ZMQ_PULL'
|
279
|
+
Direction:: Unidirectional
|
280
|
+
Send/receive pattern:: Send only
|
281
|
+
Incoming routing strategy:: N/A
|
282
|
+
Outgoing routing strategy:: Round-robin
|
283
|
+
Action in mute state:: Block
|
284
|
+
|
285
|
+
|
286
|
+
ZMQ_PULL
|
287
|
+
^^^^^^^^
|
288
|
+
A socket of type 'ZMQ_PULL' is used by a pipeline _node_ to receive messages
|
289
|
+
from upstream pipeline _nodes_. Messages are fair-queued from among all
|
290
|
+
connected upstream _nodes_. The _zmq_send()_ function is not implemented for
|
291
|
+
this socket type.
|
292
|
+
|
293
|
+
[horizontal]
|
294
|
+
.Summary of ZMQ_PULL characteristics
|
295
|
+
Compatible peer sockets:: 'ZMQ_PUSH'
|
296
|
+
Direction:: Unidirectional
|
297
|
+
Send/receive pattern:: Receive only
|
298
|
+
Incoming routing strategy:: Fair-queued
|
299
|
+
Outgoing routing strategy:: N/A
|
300
|
+
Action in mute state:: Block
|
301
|
+
|
302
|
+
|
303
|
+
Exclusive pair pattern
|
304
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
305
|
+
The exclusive pair pattern is used to connect a peer to precisely one other
|
306
|
+
peer. This pattern is used for inter-thread communication across the inproc
|
307
|
+
transport.
|
308
|
+
|
309
|
+
|
310
|
+
ZMQ_PAIR
|
311
|
+
^^^^^^^^
|
312
|
+
A socket of type 'ZMQ_PAIR' can only be connected to a single peer at any one
|
313
|
+
time. No message routing or filtering is performed on messages sent over a
|
314
|
+
'ZMQ_PAIR' socket.
|
315
|
+
|
316
|
+
When a 'ZMQ_PAIR' socket enters the 'mute' state due to having reached the
|
317
|
+
high water mark for the connected peer, or if no peer is connected, then
|
318
|
+
any linkzmq:zmq_send[3] operations on the socket shall block until the peer
|
319
|
+
becomes available for sending; messages are not discarded.
|
320
|
+
|
321
|
+
NOTE: 'ZMQ_PAIR' sockets are designed for inter-thread communication across
|
322
|
+
the linkzmq:zmq_inproc[7] transport and do not implement functionality such
|
323
|
+
as auto-reconnection. 'ZMQ_PAIR' sockets are considered experimental and may
|
324
|
+
have other missing or broken aspects.
|
325
|
+
|
326
|
+
[horizontal]
|
327
|
+
.Summary of ZMQ_PAIR characteristics
|
328
|
+
Compatible peer sockets:: 'ZMQ_PAIR'
|
329
|
+
Direction:: Bidirectional
|
330
|
+
Send/receive pattern:: Unrestricted
|
331
|
+
Incoming routing strategy:: N/A
|
332
|
+
Outgoing routing strategy:: N/A
|
333
|
+
Action in mute state:: Block
|
334
|
+
|
335
|
+
|
336
|
+
RETURN VALUE
|
337
|
+
------------
|
338
|
+
The _zmq_socket()_ function shall return an opaque handle to the newly created
|
339
|
+
socket if successful. Otherwise, it shall return NULL and set 'errno' to one of
|
340
|
+
the values defined below.
|
341
|
+
|
342
|
+
|
343
|
+
ERRORS
|
344
|
+
------
|
345
|
+
*EINVAL*::
|
346
|
+
The requested socket 'type' is invalid.
|
347
|
+
*EFAULT*::
|
348
|
+
The provided 'context' is invalid.
|
349
|
+
*EMFILE*::
|
350
|
+
The limit on the total number of open 0MQ sockets has been reached.
|
351
|
+
*ETERM*::
|
352
|
+
The context specified was terminated.
|
353
|
+
|
354
|
+
SEE ALSO
|
355
|
+
--------
|
356
|
+
linkzmq:zmq_init[3]
|
357
|
+
linkzmq:zmq_setsockopt[3]
|
358
|
+
linkzmq:zmq_bind[3]
|
359
|
+
linkzmq:zmq_connect[3]
|
360
|
+
linkzmq:zmq_send[3]
|
361
|
+
linkzmq:zmq_recv[3]
|
362
|
+
linkzmq:zmq_inproc[7]
|
363
|
+
linkzmq:zmq[7]
|
364
|
+
|
365
|
+
|
366
|
+
AUTHORS
|
367
|
+
-------
|
368
|
+
This 0MQ manual page was written by Martin Sustrik <sustrik@250bpm.com>,
|
369
|
+
Martin Lucina <mato@kotelna.sk>, and Pieter Hintjens <ph@imatix.com>.
|
@@ -0,0 +1,288 @@
|
|
1
|
+
zmq_ctx_socket_monitor(3)
|
2
|
+
=========================
|
3
|
+
|
4
|
+
|
5
|
+
NAME
|
6
|
+
----
|
7
|
+
|
8
|
+
zmq_socket_monitor - register a monitoring callback
|
9
|
+
|
10
|
+
|
11
|
+
SYNOPSIS
|
12
|
+
--------
|
13
|
+
*int zmq_socket_monitor (void '*socket', char * '*addr', int 'events');*
|
14
|
+
|
15
|
+
|
16
|
+
DESCRIPTION
|
17
|
+
-----------
|
18
|
+
The _zmq_socket_monitor()_ function shall spawn a 'PAIR' socket that publishes
|
19
|
+
socket state changes (events) over the inproc:// transport to a given endpoint.
|
20
|
+
Messages are 'zmq_event_t' structs. It's recommended to connect via a 'PAIR'
|
21
|
+
socket in another application thread and handle monitoring events there. It's
|
22
|
+
possible to also supply a bitmask ('ZMQ_EVENT_ALL' or any combination of the
|
23
|
+
'ZMQ_EVENT_*' constants) of the events you're interested in.
|
24
|
+
|
25
|
+
----
|
26
|
+
// monitoring thread
|
27
|
+
static void *req_socket_monitor (void *ctx)
|
28
|
+
{
|
29
|
+
zmq_event_t event;
|
30
|
+
int rc;
|
31
|
+
|
32
|
+
void *s = zmq_socket (ctx, ZMQ_PAIR);
|
33
|
+
assert (s);
|
34
|
+
|
35
|
+
rc = zmq_connect (s, "inproc://monitor.req");
|
36
|
+
assert (rc == 0);
|
37
|
+
while (true) {
|
38
|
+
zmq_msg_t msg;
|
39
|
+
zmq_msg_init (&msg);
|
40
|
+
rc = zmq_recvmsg (s, &msg, 0);
|
41
|
+
if (rc == -1 && zmq_errno() == ETERM) break;
|
42
|
+
assert (rc != -1);
|
43
|
+
memcpy (&event, zmq_msg_data (&msg), sizeof (event));
|
44
|
+
switch (event.event) {
|
45
|
+
case ZMQ_EVENT_CONNECTED:
|
46
|
+
// handle socket connected event
|
47
|
+
break;
|
48
|
+
case ZMQ_EVENT_CLOSED:
|
49
|
+
// handle socket closed event
|
50
|
+
break;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
zmq_close (s);
|
54
|
+
return NULL;
|
55
|
+
}
|
56
|
+
|
57
|
+
// register a monitor endpoint for all socket events
|
58
|
+
rc = zmq_socket_monitor (req, "inproc://monitor.req", ZMQ_EVENT_ALL);
|
59
|
+
assert (rc == 0);
|
60
|
+
|
61
|
+
// spawn a monitoring thread
|
62
|
+
rc = pthread_create (&threads [0], NULL, req_socket_monitor, ctx);
|
63
|
+
assert (rc == 0);
|
64
|
+
----
|
65
|
+
|
66
|
+
Only connection oriented (tcp and ipc) transports are supported in this initial
|
67
|
+
implementation.
|
68
|
+
|
69
|
+
Supported events are:
|
70
|
+
|
71
|
+
|
72
|
+
ZMQ_EVENT_CONNECTED: connection established
|
73
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
74
|
+
The 'ZMQ_EVENT_CONNECTED' event triggers when a connection has been established
|
75
|
+
to a remote peer. This can happen either synchronous or asynchronous.
|
76
|
+
|
77
|
+
.Event metadata:
|
78
|
+
----
|
79
|
+
data.connected.addr // peer address
|
80
|
+
data.connected.fd // socket descriptor
|
81
|
+
----
|
82
|
+
|
83
|
+
ZMQ_EVENT_CONNECT_DELAYED: synchronous connect failed, it's being polled
|
84
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
85
|
+
The 'ZMQ_EVENT_CONNECT_DELAYED' event triggers when an immediate connection
|
86
|
+
attempt is delayed and it's completion's being polled for.
|
87
|
+
|
88
|
+
.Event metadata:
|
89
|
+
----
|
90
|
+
data.connect_delayed.addr // peer address
|
91
|
+
data.connect_delayed.err // errno value
|
92
|
+
----
|
93
|
+
|
94
|
+
ZMQ_EVENT_CONNECT_RETRIED: asynchronous connect / reconnection attempt
|
95
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
96
|
+
The 'ZMQ_EVENT_CONNECT_RETRIED' event triggers when a connection attempt
|
97
|
+
is being handled by reconnect timer. The reconnect interval's recomputed
|
98
|
+
for each attempt.
|
99
|
+
|
100
|
+
.Event metadata:
|
101
|
+
----
|
102
|
+
data.connect_retried.addr // peer address
|
103
|
+
data.connect_retried.interval // computed reconnect interval
|
104
|
+
----
|
105
|
+
|
106
|
+
ZMQ_EVENT_LISTENING: socket bound to an address, ready to accept connections
|
107
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
108
|
+
The 'ZMQ_EVENT_LISTENING' event triggers when a socket's successfully bound
|
109
|
+
to a an interface.
|
110
|
+
|
111
|
+
.Event metadata:
|
112
|
+
----
|
113
|
+
data.listening.addr // listen address
|
114
|
+
data.listening.fd // socket descriptor
|
115
|
+
----
|
116
|
+
|
117
|
+
ZMQ_EVENT_BIND_FAILED: socket could not bind to an address
|
118
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
119
|
+
The 'ZMQ_EVENT_BIND_FAILED' event triggers when a socket could not bind to
|
120
|
+
a given interface.
|
121
|
+
|
122
|
+
.Event metadata:
|
123
|
+
----
|
124
|
+
data.bind_failed.addr // listen address
|
125
|
+
data.bind_failed.err // errno value
|
126
|
+
----
|
127
|
+
|
128
|
+
ZMQ_EVENT_ACCEPTED: connection accepted to bound interface
|
129
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
130
|
+
The 'ZMQ_EVENT_ACCEPTED' event triggers when a connection from a remote peer
|
131
|
+
has been established with a socket's listen address.
|
132
|
+
|
133
|
+
.Event metadata:
|
134
|
+
----
|
135
|
+
data.accepted.addr // listen address
|
136
|
+
data.accepted.fd // socket descriptor
|
137
|
+
----
|
138
|
+
|
139
|
+
ZMQ_EVENT_ACCEPT_FAILED: could not accept client connection
|
140
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
141
|
+
The 'ZMQ_EVENT_ACCEPT_FAILED' event triggers when a connection attempt to
|
142
|
+
a socket's bound address fails.
|
143
|
+
|
144
|
+
.Event metadata:
|
145
|
+
----
|
146
|
+
data.accept_failed.addr // listen address
|
147
|
+
data.accept_failed.err // errno value
|
148
|
+
----
|
149
|
+
|
150
|
+
ZMQ_EVENT_CLOSED: connection closed
|
151
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
152
|
+
The 'ZMQ_EVENT_CLOSED' event triggers when a connection's underlying descriptor
|
153
|
+
has been closed.
|
154
|
+
|
155
|
+
.Event metadata:
|
156
|
+
----
|
157
|
+
data.closed.addr // address
|
158
|
+
data.closed.fd // socket descriptor
|
159
|
+
----
|
160
|
+
|
161
|
+
ZMQ_EVENT_CLOSE_FAILED: connection couldn't be closed
|
162
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
163
|
+
The 'ZMQ_EVENT_CLOSE_FAILED' event triggers when a descriptor could not be
|
164
|
+
released back to the OS.
|
165
|
+
|
166
|
+
.Event metadata:
|
167
|
+
----
|
168
|
+
data.close_failed.addr // address
|
169
|
+
data.close_failed.err // errno value
|
170
|
+
----
|
171
|
+
|
172
|
+
ZMQ_EVENT_DISCONNECTED: broken session
|
173
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
174
|
+
The 'ZMQ_EVENT_DISCONNECTED' event triggers when the stream engine (tcp and ipc
|
175
|
+
specific) detects a corrupted / broken session.
|
176
|
+
|
177
|
+
.Event metadata:
|
178
|
+
----
|
179
|
+
data.disconnected.addr // address
|
180
|
+
data.disconnected.fd // socket descriptor
|
181
|
+
----
|
182
|
+
|
183
|
+
RETURN VALUE
|
184
|
+
------------
|
185
|
+
The _zmq_socket_monitor()_ function returns a value of 0 or greater if
|
186
|
+
successful. Otherwise it returns `-1` and sets 'errno' to one of the values
|
187
|
+
defined below.
|
188
|
+
|
189
|
+
|
190
|
+
ERRORS
|
191
|
+
------
|
192
|
+
*ETERM*::
|
193
|
+
The 0MQ 'context' associated with the specified 'socket' was terminated.
|
194
|
+
|
195
|
+
*EPROTONOSUPPORT*::
|
196
|
+
The requested 'transport' protocol is not supported. Monitor sockets are
|
197
|
+
required to use the inproc:// transport.
|
198
|
+
|
199
|
+
*EINVAL*::
|
200
|
+
The endpoint supplied is invalid.
|
201
|
+
|
202
|
+
EXAMPLE
|
203
|
+
-------
|
204
|
+
.Observing a 'REP' socket's connection state
|
205
|
+
----
|
206
|
+
// REP socket monitor thread
|
207
|
+
static void *rep_socket_monitor (void *ctx)
|
208
|
+
{
|
209
|
+
zmq_event_t event;
|
210
|
+
int rc;
|
211
|
+
|
212
|
+
void *s = zmq_socket (ctx, ZMQ_PAIR);
|
213
|
+
assert (s);
|
214
|
+
|
215
|
+
rc = zmq_connect (s, "inproc://monitor.rep");
|
216
|
+
assert (rc == 0);
|
217
|
+
while (true) {
|
218
|
+
zmq_msg_t msg;
|
219
|
+
zmq_msg_init (&msg);
|
220
|
+
rc = zmq_recvmsg (s, &msg, 0);
|
221
|
+
if (rc == -1 && zmq_errno() == ETERM) break;
|
222
|
+
assert (rc != -1);
|
223
|
+
memcpy (&event, zmq_msg_data (&msg), sizeof (event));
|
224
|
+
switch (event.event) {
|
225
|
+
case ZMQ_EVENT_LISTENING:
|
226
|
+
printf ("listening socket descriptor %d\n", event.data.listening.fd);
|
227
|
+
printf ("listening socket address %s\n", event.data.listening.addr);
|
228
|
+
break;
|
229
|
+
case ZMQ_EVENT_ACCEPTED:
|
230
|
+
printf ("accepted socket descriptor %d\n", event.data.accepted.fd);
|
231
|
+
printf ("accepted socket address %s\n", event.data.accepted.addr);
|
232
|
+
break;
|
233
|
+
case ZMQ_EVENT_CLOSE_FAILED:
|
234
|
+
printf ("socket close failure error code %d\n", event.data.close_failed.err);
|
235
|
+
printf ("socket address %s\n", event.data.close_failed.addr);
|
236
|
+
break;
|
237
|
+
case ZMQ_EVENT_CLOSED:
|
238
|
+
printf ("closed socket descriptor %d\n", event.data.closed.fd);
|
239
|
+
printf ("closed socket address %s\n", event.data.closed.addr);
|
240
|
+
break;
|
241
|
+
case ZMQ_EVENT_DISCONNECTED:
|
242
|
+
printf ("disconnected socket descriptor %d\n", event.data.disconnected.fd);
|
243
|
+
printf ("disconnected socket address %s\n", event.data.disconnected.addr);
|
244
|
+
break;
|
245
|
+
}
|
246
|
+
zmq_msg_close (&msg);
|
247
|
+
}
|
248
|
+
zmq_close (s);
|
249
|
+
return NULL;
|
250
|
+
}
|
251
|
+
|
252
|
+
|
253
|
+
// Create the infrastructure
|
254
|
+
void *ctx = zmq_init (1);
|
255
|
+
assert (ctx);
|
256
|
+
|
257
|
+
// REP socket
|
258
|
+
rep = zmq_socket (ctx, ZMQ_REP);
|
259
|
+
assert (rep);
|
260
|
+
|
261
|
+
// REP socket monitor, all events
|
262
|
+
rc = zmq_socket_monitor (rep, "inproc://monitor.rep", ZMQ_EVENT_ALL);
|
263
|
+
assert (rc == 0);
|
264
|
+
rc = pthread_create (&threads [0], NULL, rep_socket_monitor, ctx);
|
265
|
+
assert (rc == 0);
|
266
|
+
|
267
|
+
rc = zmq_bind (rep, addr);
|
268
|
+
assert (rc == 0);
|
269
|
+
|
270
|
+
// Allow some time for event detection
|
271
|
+
zmq_sleep (1);
|
272
|
+
|
273
|
+
// Close the REP socket
|
274
|
+
rc = zmq_close (rep);
|
275
|
+
assert (rc == 0);
|
276
|
+
|
277
|
+
zmq_term (ctx);
|
278
|
+
----
|
279
|
+
|
280
|
+
|
281
|
+
SEE ALSO
|
282
|
+
--------
|
283
|
+
linkzmq:zmq[7]
|
284
|
+
|
285
|
+
|
286
|
+
AUTHORS
|
287
|
+
-------
|
288
|
+
This 0MQ manual page was written by Lourens Naudé <lourens@methodmissing.com>
|