Commit 7cab423f authored by Martin Hurton's avatar Martin Hurton

Merge branch 'master' of github.com:sustrik/zeromq2

parents bc9b7f1f 354efc51
...@@ -32,3 +32,8 @@ perf/cpp/local_lat ...@@ -32,3 +32,8 @@ perf/cpp/local_lat
perf/cpp/local_thr perf/cpp/local_thr
perf/cpp/remote_lat perf/cpp/remote_lat
perf/cpp/remote_thr perf/cpp/remote_thr
doc/*.1
doc/*.3
doc/*.7
doc/*.html
doc/*.xml
...@@ -4,12 +4,8 @@ if BUILD_PERF ...@@ -4,12 +4,8 @@ if BUILD_PERF
DIR_PERF = perf DIR_PERF = perf
endif endif
if INSTALL_MAN SUBDIRS = src doc $(DIR_PERF) devices bindings examples
DIR_MAN = man DIST_SUBDIRS = src doc perf devices bindings examples
endif
SUBDIRS = src $(DIR_MAN) $(DIR_PERF) devices bindings examples
DIST_SUBDIRS = src man perf devices bindings examples
EXTRA_DIST = \ EXTRA_DIST = \
$(top_srcdir)/foreign/openpgm/@pgm2_basename@.tar.bz2 \ $(top_srcdir)/foreign/openpgm/@pgm2_basename@.tar.bz2 \
......
...@@ -50,9 +50,20 @@ on_mingw32="no" ...@@ -50,9 +50,20 @@ on_mingw32="no"
# Host speciffic checks # Host speciffic checks
AC_CANONICAL_HOST AC_CANONICAL_HOST
# Whether or not install manual pages. # Determine whether or not documentation should be built.
# Note that on MinGW manpages are not installed. build_doc="yes"
install_man="yes" install_man="yes"
if test ! -f "doc/zmq.html"; then
# We are building from git.
# Check for asciidoc and xmlto and don't build the docs if these are not installed.
AC_CHECK_PROG(have_asciidoc, asciidoc, yes, no)
AC_CHECK_PROG(have_xmlto, xmlto, yes, no)
if test "x$have_asciidoc" = "xno" -o "x$have_xmlto" = "xno"; then
build_doc="no"
install_man="no"
AC_MSG_WARN([You are building from git and asciidoc is not installed. Documentation will not be built or installed.])
fi
fi
case "${host_os}" in case "${host_os}" in
*linux*) *linux*)
...@@ -551,6 +562,7 @@ AM_CONDITIONAL(BUILD_CHAT, test "x$chat" = "xyes") ...@@ -551,6 +562,7 @@ AM_CONDITIONAL(BUILD_CHAT, test "x$chat" = "xyes")
AM_CONDITIONAL(ON_MINGW, test "x$on_mingw32" = "xyes") AM_CONDITIONAL(ON_MINGW, test "x$on_mingw32" = "xyes")
AM_CONDITIONAL(BUILD_PGM2_EXAMPLES, test "x$with_pgm2_examples" = "xyes") AM_CONDITIONAL(BUILD_PGM2_EXAMPLES, test "x$with_pgm2_examples" = "xyes")
AM_CONDITIONAL(INSTALL_MAN, test "x$install_man" = "xyes") AM_CONDITIONAL(INSTALL_MAN, test "x$install_man" = "xyes")
AM_CONDITIONAL(BUILD_DOC, test "x$build_doc" = "xyes")
AC_SUBST(stdint) AC_SUBST(stdint)
AC_SUBST(inttypes) AC_SUBST(inttypes)
...@@ -565,7 +577,7 @@ AC_FUNC_MALLOC ...@@ -565,7 +577,7 @@ AC_FUNC_MALLOC
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs) AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
AC_OUTPUT(Makefile src/Makefile man/Makefile bindings/python/Makefile \ AC_OUTPUT(Makefile src/Makefile doc/Makefile bindings/python/Makefile \
bindings/python/setup.py bindings/ruby/Makefile \ bindings/python/setup.py bindings/ruby/Makefile \
bindings/java/Makefile perf/Makefile perf/c/Makefile perf/cpp/Makefile \ bindings/java/Makefile perf/Makefile perf/c/Makefile perf/cpp/Makefile \
perf/python/Makefile perf/ruby/Makefile perf/java/Makefile src/libzmq.pc \ perf/python/Makefile perf/ruby/Makefile perf/java/Makefile src/libzmq.pc \
...@@ -615,6 +627,7 @@ AC_MSG_RESULT([ Queue: $queue]) ...@@ -615,6 +627,7 @@ AC_MSG_RESULT([ Queue: $queue])
AC_MSG_RESULT([ Performance tests: $perf]) AC_MSG_RESULT([ Performance tests: $perf])
AC_MSG_RESULT([ Examples:]) AC_MSG_RESULT([ Examples:])
AC_MSG_RESULT([ Chat: $chat]) AC_MSG_RESULT([ Chat: $chat])
AC_MSG_RESULT([ Documentation: $build_doc])
AC_MSG_RESULT([]) AC_MSG_RESULT([])
AC_MSG_RESULT([ ******************************************************** ]) AC_MSG_RESULT([ ******************************************************** ])
AC_MSG_RESULT([]) AC_MSG_RESULT([])
......
MAN1 = zmq_forwarder.1 zmq_streamer.1 zmq_queue.1
MAN3 = zmq_bind.3 zmq_close.3 zmq_connect.3 zmq_flush.3 zmq_init.3 \
zmq_msg_close.3 zmq_msg_copy.3 zmq_msg_data.3 zmq_msg_init.3 \
zmq_msg_init_data.3 zmq_msg_init_size.3 zmq_msg_move.3 zmq_msg_size.3 \
zmq_poll.3 zmq_recv.3 zmq_send.3 zmq_setsockopt.3 zmq_socket.3 zmq_strerror.3 \
zmq_term.3
MAN7 = zmq.7 zmq_tcp.7 zmq_udp.7 zmq_pgm.7 zmq_inproc.7 zmq_ipc.7 \
zmq_cpp.7 zmq_java.7 zmq_python.7
MAN_DOC = $(MAN1) $(MAN3) $(MAN7)
MAN_TXT = $(MAN1:%.1=%.txt)
MAN_TXT += $(MAN3:%.3=%.txt)
MAN_TXT += $(MAN7:%.7=%.txt)
MAN_HTML = $(MAN_TXT:%.txt=%.html)
if INSTALL_MAN
dist_man_MANS = $(MAN_DOC)
endif
EXTRA_DIST = $(MAN_TXT)
if BUILD_DOC
EXTRA_DIST += $(MAN_HTML)
endif
MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML)
dist-hook : $(MAN_DOC) $(MAN_HTML)
SUFFIXES=.html .txt .xml .1 .3 .7
.txt.html:
asciidoc -d manpage -b xhtml11 -f asciidoc.conf $<
.txt.xml:
asciidoc -d manpage -b docbook -f asciidoc.conf $<
.xml.1:
xmlto man $<
.xml.3:
xmlto man $<
.xml.7:
xmlto man $<
[macros]
(?su)[\\]?(?P<name>linkzmq):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
ifdef::backend-docbook[]
[linkzmq-inlinemacro]
{0%{target}}
{0#<citerefentry>}
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
{0#</citerefentry>}
endif::backend-docbook[]
ifdef::backend-xhtml11[]
[linkzmq-inlinemacro]
<a href="{target}.html">{target}{0?({0})}</a>
endif::backend-xhtml11[]
ifdef::doctype-manpage[]
ifdef::backend-docbook[]
[header]
template::[header-declarations]
<refentry>
<refmeta>
<refentrytitle>{mantitle}</refentrytitle>
<manvolnum>{manvolnum}</manvolnum>
<refmiscinfo class="source">0MQ</refmiscinfo>
<refmiscinfo class="version">2.0.0</refmiscinfo>
<refmiscinfo class="manual">0MQ Manual</refmiscinfo>
</refmeta>
<refnamediv>
<refname>{manname}</refname>
<refpurpose>{manpurpose}</refpurpose>
</refnamediv>
endif::backend-docbook[]
endif::doctype-manpage[]
.TH zmq 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq(7)
.SH NAME ======
0MQ \- a lightweight messaging kernel
.SH SYNOPSIS
NAME
----
zmq - 0MQ lightweight messaging kernel
SYNOPSIS
--------
0MQ is an extension of POSIX sockets. It is a library that augments standard 0MQ is an extension of POSIX sockets. It is a library that augments standard
networking sockets by special capabilities that you can otherwise get only networking sockets by special capabilities that you can otherwise get only
by using specialised "messaging middleware" products, such as automated by using specialised "messaging middleware" products, such as automated
...@@ -25,19 +31,23 @@ microarchitectures. ...@@ -25,19 +31,23 @@ microarchitectures.
0MQ is fully open sourced LGPL-licensed software. 0MQ is fully open sourced LGPL-licensed software.
.SH CONTEXT
CONTEXT
-------
Each 0MQ socket lives within a specific context. Creating and destroying Each 0MQ socket lives within a specific context. Creating and destroying
context is a counterpart of library initialisation/deinitialisation as used context is a counterpart of library initialisation/deinitialisation as used
elsewhere. Ability to create multiple contexts saves the day when an application elsewhere. Ability to create multiple contexts saves the day when an application
happens to link (indirectly and involuntarily) with several instances of 0MQ. happens to link (indirectly and involuntarily) with several instances of 0MQ.
Initialise 0MQ context: Initialise 0MQ context::
.BR zmq_init(3) linkzmq:zmq_init[3]
Uninitialise 0MQ context: Uninitialise 0MQ context::
.BR zmq_term(3) linkzmq:zmq_term[3]
.SH MESSAGES
MESSAGES
--------
Message is a discrete unit of data passed between applications or components Message is a discrete unit of data passed between applications or components
of the same application. 0MQ message has no internal structure, it is an opaque of the same application. 0MQ message has no internal structure, it is an opaque
BLOB. When writing data to or reading data from the message, you are free to BLOB. When writing data to or reading data from the message, you are free to
...@@ -46,106 +56,120 @@ use your own serialisation code. The latter option is especially useful when ...@@ -46,106 +56,120 @@ use your own serialisation code. The latter option is especially useful when
migrating legacy applications to 0MQ - there's no need to break existing migrating legacy applications to 0MQ - there's no need to break existing
message formats. message formats.
Initialise a message: Initialise a message::
.BR zmq_msg_init(3) linkzmq:zmq_msg_init[3]
.BR zmq_msg_size(3) linkzmq:zmq_msg_size[3]
.BR zmq_msg_data(3) linkzmq:zmq_msg_data[3]
Uninitialise a message::
linkzmq:zmq_msg_close[3]
Uninitialise a message: Access message content::
.BR zmq_msg_close(3) linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]
Access message content: Message manipulation::
.BR zmq_msg_data(3) linkzmq:zmq_msg_copy[3]
.BR zmq_msg_size(3) linkzmq:zmq_msg_move[3]
Message manipulation:
.BR zmq_msg_copy(3)
.BR zmq_msg_move(3)
.SH SOCKETS SOCKETS
-------
0MQ sockets are very similar to POSIX sockets. See following manual pages to 0MQ sockets are very similar to POSIX sockets. See following manual pages to
understand them in depth. understand them in depth.
Creating a socket: Creating a socket::
.BR zmq_socket(3) linkzmq:zmq_socket[3]
Closing a socket::
linkzmq:zmq_close[3]
Closing a socket: Setting socket options::
.BR zmq_close(3) linkzmq:zmq_setsockopt[3]
Setting socket options: Establishing a message flow::
.BR zmq_setsockopt(3) linkzmq:zmq_bind[3]
linkzmq:zmq_connect[3]
Establishing a message flow: Sending & receiving messages::
.BR zmq_bind(3) linkzmq:zmq_send[3]
.BR zmq_connect(3) linkzmq:zmq_flush[3]
linkzmq:zmq_recv[3]
Sending & receiving messages:
.BR zmq_send(3)
.BR zmq_flush(3)
.BR zmq_recv(3)
.SH MULTIPLEXING MULTIPLEXING
------------
0MQ allows you to handle multiple sockets (0MQ as well as standard POSIX) 0MQ allows you to handle multiple sockets (0MQ as well as standard POSIX)
in an asynchronous manner. in an asynchronous manner.
Poll for I/O events: Poll for I/O events::
.BR zmq_poll(3) linkzmq:zmq_poll[3]
.SH ERROR HANDLING
ERROR HANDLING
--------------
0MQ defines couple of non-POSIX error codes. Use following functions to handle 0MQ defines couple of non-POSIX error codes. Use following functions to handle
them neatly. them neatly.
Convert error code into human readable string: Convert error code into human readable string::
.BR zmq_strerror(3) linkzmq:zmq_strerror[3]
.SH TRANSPORTS TRANSPORTS
----------
0MQ allows for using different underlying transport mechanisms (even multiple 0MQ allows for using different underlying transport mechanisms (even multiple
at once). Each transport mechanism has its own advantages and drawbacks. For at once). Each transport mechanism has its own advantages and drawbacks. For
detailed description of individual mechanisms check following manual pages: detailed description of individual mechanisms check following manual pages:
TCP/IP transport: TCP/IP transport::
.BR zmq_tcp(7) linkzmq:zmq_tcp[7]
UDP reliable multicast transport: UDP reliable multicast transport::
.BR zmq_udp(7) linkzmq:zmq_udp[7]
PGM reliable multicast transport: PGM reliable multicast transport::
.BR zmq_pgm(7) linkzmq:zmq_pgm[7]
Inter-process transport: Inter-process transport::
.BR zmq_ipc (7) linkzmq:zmq_ipc[7]
In-process (inter-thread) transport: In-process (inter-thread) transport::
.BR zmq_inproc(7) linkzmq:zmq_inproc[7]
.SH DEVICES
DEVICES
-------
Aside of the messaging library (a.k.a. messaging kernel) 0MQ provides pre-built Aside of the messaging library (a.k.a. messaging kernel) 0MQ provides pre-built
executables - devices - to serve as middle nodes in complex messaging executables - devices - to serve as middle nodes in complex messaging
topologies. For detailed description of individual devices check following topologies. For detailed description of individual devices check following
manual pages: manual pages:
Forwarder device for PUB/SUB messaging: Forwarder device for PUB/SUB messaging::
.BR zmq_forwarder(1) linkzmq:zmq_forwarder[1]
Streamer device for UPSTREAM/DOWNSTREAM messaging::
linkzmq:zmq_streamer[1]
Streamer device for UPSTREAM/DOWNSTREAM messaging: Forwarder device for REQ/REP messaging::
.BR zmq_streamer(1) linkzmq:zmq_queue[1]
.SH LANGUAGES
LANGUAGES
---------
0MQ manual pages provide info on C API. To find out how the your 0MQ manual pages provide info on C API. To find out how the your
favourite language API maps to C API and thus how to find relevant manual pages, favourite language API maps to C API and thus how to find relevant manual pages,
see following articles: see following articles:
C++: $$C++$$::
.BR zmq_cpp(7) linkzmq:zmq_cpp[7]
Common Lisp: Java::
.BR zmq_cl(7) linkzmq:zmq_java[7]
Python: Python::
.BR zmq_python(7) linkzmq:zmq_python[7]
Ruby:
.BR zmq_ruby(7)
.SH AUTHOR AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_bind 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_bind(3)
.SH NAME ===========
zmq_bind \- binds the socket to the specified address
.SH SYNOPSIS
.B int zmq_bind (void *s, const char *addr); NAME
.SH DESCRIPTION ----
The function binds socket zmq_bind - binds the socket to the specified address
.IR s
to a particular transport. Actual semantics of the
SYNOPSIS
--------
'int zmq_bind (void *s, const char *addr);'
DESCRIPTION
-----------
The function binds socket 's' to a particular transport. Actual semantics of the
command depend on the underlying transport mechanism, however, in cases where command depend on the underlying transport mechanism, however, in cases where
peers connect in an asymmetric manner, peers connect in an asymmetric manner, 'zmq_bind' should be called first,
.IR zmq_bind 'zmq_connect' afterwards. Actual formats of 'addr' parameter are defined by
should be called first, individual transports. For a list of supported transports have a look at
.IR zmq_connect linkzmq:zmq[7] manual page.
afterwards. Actual formats of
.IR addr
parameter are defined by individual transports. For a list of supported
transports have a look at
.IR zmq(7)
manual page.
Note that single socket can be bound (and connected) to Note that single socket can be bound (and connected) to
arbitrary number of peers using different transport mechanisms. arbitrary number of peers using different transport mechanisms.
.SH RETURN VALUE
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
.IP "\fBEPROTONOSUPPORT\fP" ------
*EPROTONOSUPPORT*::
unsupported protocol. unsupported protocol.
.IP "\fBENOCOMPATPROTO\fP" *ENOCOMPATPROTO*::
protocol is not compatible with the socket type. protocol is not compatible with the socket type.
.IP "\fBEADDRINUSE\fP" *EADDRINUSE*::
the given address is already in use. the given address is already in use.
.IP "\fBEADDRNOTAVAIL\fP" *EADDRNOTAVAIL*::
a nonexistent interface was requested or the requested address was not local. a nonexistent interface was requested or the requested address was not local.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
void *s = zmq_socket (context, ZMQ_PUB); void *s = zmq_socket (context, ZMQ_PUB);
assert (s); assert (s);
int rc = zmq_bind (s, "inproc://my_publisher"); int rc = zmq_bind (s, "inproc://my_publisher");
assert (rc == 0); assert (rc == 0);
rc = zmq_bind (s, "tcp://eth0:5555"); rc = zmq_bind (s, "tcp://eth0:5555");
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_connect (3)
.BR zmq_socket (3) SEE ALSO
.BR zmq (7) --------
.SH AUTHOR linkzmq:zmq_connect[3]
linkzmq:zmq_socket[3]
linkzmq:zmq[7]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
zmq_close(3)
============
NAME
----
zmq_close - destroys 0MQ socket
SYNOPSIS
--------
'int zmq_close (void *s);'
DESCRIPTION
-----------
Destroys 0MQ socket (one created using
'zmq_socket' function). All sockets have to be properly closed before the
application terminates, otherwise memory leaks will occur. Note that any
outbound messages that haven't been psuhed to the network yet and any inbound
messages that haven't been received by the application yet will be dropped on
the socket shutdown.
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and
sets 'errno' to the appropriate value.
ERRORS
------
No errors are defined.
EXAMPLE
-------
----
int rc = zmq_close (s);
assert (rc == 0);
----
SEE ALSO
--------
linkzmq:zmq_socket[3]
linkzmq:zmq_term[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_connect 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_connect(3)
.SH NAME ==============
zmq_connect \- connect the socket to the specified peer
.SH SYNOPSIS
.B int zmq_connect (void *s, const char *addr); NAME
.SH DESCRIPTION ----
The function connect socket zmq_connect - connect the socket to the specified peer
.IR s
to the peer identified by
.IR addr . SYNOPSIS
Actual semantics of the command depend on the underlying transport mechanism, --------
however, in cases where peers connect in an asymmetric manner, 'int zmq_connect (void *s, const char *addr);'
.IR zmq_bind
should be called first,
.IR zmq_connect DESCRIPTION
afterwards. Formats of the -----------
.IR addr The function connect socket 's' to the peer identified by 'addr'. Actual
semantics of the command depend on the underlying transport mechanism,
however, in cases where peers connect in an asymmetric manner, 'zmq_bind'
should be called first, 'zmq_connect' afterwards. Formats of the 'addr'
parameter are defined by individual transports. For a list of supported parameter are defined by individual transports. For a list of supported
transports have a look at transports have a look at linkzmq:zmq[7] manual page.
.IR zmq(7)
manual page.
Note that single socket can be connected (and bound) to Note that single socket can be connected (and bound) to
arbitrary number of peers using different transport mechanisms. arbitrary number of peers using different transport mechanisms.
.SH RETURN VALUE
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
.IP "\fBEPROTONOSUPPORT\fP" ------
*EPROTONOSUPPORT*::
unsupported protocol. unsupported protocol.
.IP "\fBENOCOMPATPROTO\fP" *ENOCOMPATPROTO*::
protocol is not compatible with the socket type. protocol is not compatible with the socket type.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
void *s = zmq_socket (context, ZMQ_SUB); void *s = zmq_socket (context, ZMQ_SUB);
assert (s); assert (s);
int rc = zmq_connect (s, "inproc://my_publisher"); int rc = zmq_connect (s, "inproc://my_publisher");
assert (rc == 0); assert (rc == 0);
rc = zmq_connect (s, "tcp://server001:5555"); rc = zmq_connect (s, "tcp://server001:5555");
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_bind (3)
.BR zmq_socket (3) SEE ALSO
.BR zmq (7) --------
.SH AUTHOR linkzmq:zmq_bind[3]
linkzmq:zmq_socket[3]
linkzmq:zmq[7]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_cpp 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_cpp(7)
.SH NAME ==========
0MQ C++ API \- interface between 0MQ and C++ applications
.SH SYNOPSIS
NAME
----
zmq_cpp - interface between 0MQ and C++ applications
SYNOPSIS
--------
This manual page explains how C++ API maps to underlying C API. To learn about This manual page explains how C++ API maps to underlying C API. To learn about
individual functions and parameters check appropriate C API manual individual functions and parameters check appropriate C API manual
pages. pages.
For example, to understand For example, to understand 'zmq::socket_t::setsockopt' function check
.IR zmq::socket_t::setsockopt linkzmq:zmq_setsockopt[3].
function check
.BR zmq_setsockopt(3) .
All 0MQ constants defined with C API are available with C++ API. All 0MQ constants defined with C API are available with C++ API.
.SH zmq::context_t
zmq::context_t
--------------
This class encapsulates the functions dealing with initialisation and This class encapsulates the functions dealing with initialisation and
termination of 0MQ context. Constructor of the class invokes termination of 0MQ context. Constructor of the class invokes
.BR zmq_init(3) linkzmq:zmq_init[3] while destructor calls linkzmq:zmq_term[3].
while destructor calls
.BR zmq_term(3) .
.SH zmq::socket_t
zmq::socket_t
-------------
This class encapsulates all the functions to deal with 0MQ sockets. Constructor This class encapsulates all the functions to deal with 0MQ sockets. Constructor
calls calls linkzmq:zmq_socket[3], destructor calls linkzmq:zmq_close[3]. Other
.BR zmq_socket(3) , functions of the class are mapped to C functions with corresponding names.
destructor calls 'zmq::socket_t::bind' calls linkzmq:zmq_bind[3] etc.
.BR zmq_close(3) .
Other functions of the class are mapped to C functions with corresponding names.
.IR zmq::socket_t::bind
calls
.BR zmq_bind(3)
etc.
.SH zmq::message_t
zmq::message_t
This class encapsulates --------------
.IR zmq_msg_t This class encapsulates 'zmq_msg_t' structure and all the C functions that deal
structure and all the C functions that deal with 0MQ messages. with 0MQ messages. Constructors of the class invoke corresponding
Constructors of the class invoke corresponding initialisation functions ( initialisation functions linkzmq:zmq_msg_init[3], linkzmq:zmq_msg_init_size[3]
.BR zmq_msg_init(3) , and linkzmq:zmq_msg_init_data[3], while destructor invokes
.BR zmq_msg_init_size(3) linkzmq:zmq_msg_close[3] function.
and
.BR zmq_msg_init_data(3) ,
while destructor invokes
.BR zmq_msg_close(3)
function.
Remaining functions are mapped to C functions with corresponding names. Remaining functions are mapped to C functions with corresponding names.
For instance, For instance, 'zmq::message_t::copy' is mapped to linkzmq:zmq_msg_copy[3]
.IR zmq::message_t::copy
is mapped to
.BR zmq_msg_copy(3)
etc. etc.
C++ provides an additional function not available with C API. C++ provides an additional function not available with C API.
.IR zmq::message_t::rebuild 'zmq::message_t::rebuild' is equivalent to calling linkzmq:zmq_close[3]
is equivalent to calling followed by linkzmq:zmq_msg_init[3], linkzmq:zmq_msg_init_size[3] or
.BR zmq_close(3) linkzmq:zmq_msg_init_data[3]. It provides a way to reuse existing
followed by 'zmq::message_t' instances to store different message content.
.BR zmq_msg_init(3) ,
.BR zmq_msg_init_size (3)
or zmq::error_t
.BR zmq_msg_init_data(3) . ------------
It provides a way to reuse existing All the errors reported using 'errno' mechanism in C API are automatically
.IR zmq::message_t converted to exceptions in C++ API. 'zmq::error_t' is derived from
instances to store different message content. 'std::exception' and uses linkzmq:zmq_strerror[3] function to convert the error
code to human-readable string.
.SH zmq::error_t
All the errors reported using zmq::poll
.IR errno ---------
mechanism in C API are automatically converted to exceptions in C++ API. 'zmq::poll' function is a namespaced equivalent of raw C linkzmq:zmq_poll[3]
.IR zmq::error_t
is derived from
.IR std::exception
and uses
.BR zmq_strerror(3)
function to convert the error code to human-readable string.
.SH zmq::poll
.IR zmq::poll
function is a namespaced equivalent of raw C
.BR zmq_poll(3)
function. function.
.SH EXAMPLE
.nf EXAMPLE
-------
----
zmq::context_t ctx (1, 1); zmq::context_t ctx (1, 1);
zmq::socket_t s (ctx, ZMQ_PUB); zmq::socket_t s (ctx, ZMQ_PUB);
s.connect ("tcp://192.168.0.115:5555"); s.connect ("tcp://192.168.0.115:5555");
zmq::message_t msg (100); zmq::message_t msg (100);
memset (msg.data (), 0, 100); memset (msg.data (), 0, 100);
s.send (msg); s.send (msg);
.fi ----
.SH "SEE ALSO"
.BR zmq(7)
.SH AUTHOR SEE ALSO
--------
linkzmq:zmq[7]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_flush 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_flush(3)
.SH NAME ============
zmq_flush \- flushes pre-sent messages to the socket
.SH SYNOPSIS
.B int zmq_flush (void *s); NAME
.SH DESCRIPTION ----
zmq_flush - flushes pre-sent messages to the socket
SYNOPSIS
--------
'int zmq_flush (void *s);'
DESCRIPTION
-----------
Flushes all the pre-sent messages - i.e. those that have been sent with Flushes all the pre-sent messages - i.e. those that have been sent with
ZMQ_NOFLUSH flag - to the socket. This functionality improves performance in ZMQ_NOFLUSH flag - to the socket. This functionality improves performance in
cases where several messages are sent during a single business operation. cases where several messages are sent during a single business operation.
It should not be used as a transaction - ACID properties are not guaranteed. It should not be used as a transaction - ACID properties are not guaranteed.
Note that calling Note that calling 'zmq_send' without ZMQ_NOFLUSH flag automatically flushes all
.IR zmq_send previously pre-sent messages.
without ZMQ_NOFLUSH flag automatically flushes all previously pre-sent messages.
.SH RETURN VALUE
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
.IP "\fBENOTSUP\fP" ------
*ENOTSUP*::
function isn't supported by particular socket type. function isn't supported by particular socket type.
.IP "\fBEFSM\fP" *EFSM*::
function cannot be called at the moment, because socket is not in the function cannot be called at the moment, because socket is not in the
approprite state. approprite state.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
rc = zmq_send (s, &msg1, ZMQ_NOFLUSH); rc = zmq_send (s, &msg1, ZMQ_NOFLUSH);
assert (rc == 0); assert (rc == 0);
rc = zmq_send (s, &msg2, ZMQ_NOFLUSH); rc = zmq_send (s, &msg2, ZMQ_NOFLUSH);
assert (rc == 0); assert (rc == 0);
rc = zmq_flush (s); rc = zmq_flush (s);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_send (3)
.SH AUTHOR SEE ALSO
--------
linkzmq:zmq_send[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
zmq_forwarder(1)
================
NAME
----
zmq_forwarder - forwards the stream of PUB/SUB messages
SYNOPSIS
--------
*
DESCRIPTION
-----------
*
OPTIONS
-------
*
SEE ALSO
--------
*
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
zmq_init(3)
===========
NAME
----
zmq_init - initialises 0MQ context
SYNOPSIS
--------
'void *zmq_init (int app_threads, int io_threads, int flags);'
DESCRIPTION
-----------
Initialises 0MQ context. 'app_threads' specifies maximal number of application
threads that can own open sockets at the same time. At least one application
thread should be defined. 'io_threads' specifies the size of thread pool to
handle I/O operations. The value shouldn't be negative. Zero can be used in
case only in-process messaging is going to be used, i.e. there will be no I/O
traffic.
The 'flags' argument is a combination of the flags defined below:
*ZMQ_POLL*::
flag specifying that the sockets within this context should be pollable
(see linkzmq:zmq_poll[3]). Pollable sockets may add a little latency to the
message transfer when compared to non-pollable sockets.
RETURN VALUE
------------
Function returns context handle is successful. Otherwise it returns NULL and
sets errno to one of the values below.
ERRORS
------
*EINVAL*::
there's less than one application thread allocated, or number of I/O
threads is negative.
EXAMPLE
-------
----
void *ctx = zmq_init (1, 1, ZMQ_POLL);
assert (ctx);
----
SEE ALSO
--------
linkzmq:zmq_term[3]
linkzmq:zmq_socket[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_inproc 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_inproc(7)
.SH NAME =============
0MQ In-process Transport \- transport to pass messages between threads
.SH SYNOPSIS
NAME
----
zmq_inproc - 0MQ transport to pass messages between threads
SYNOPSIS
--------
In-process transport is optimised for passing messages between threads in the In-process transport is optimised for passing messages between threads in the
same process. same process.
Messages are passed directly from one application thread to Messages are passed directly from one application thread to
another application thread. There are no intervening I/O threads involved. another application thread. There are no intervening I/O threads involved.
Thus, if you are using 0MQ for in-process messaging only, you can initialise Thus, if you are using 0MQ for in-process messaging only, you can initialise
the library ( the library (linkzmq:zmq_init[3]) with zero I/O worker threads.
.IR zmq_init
) with zero I/O worker threads.
.SH CONNECTION STRING
CONNECTION STRING
-----------------
Connection string for inproc transport is "inproc://" followed by an arbitrary Connection string for inproc transport is "inproc://" followed by an arbitrary
string. There are no restrictions on the string format: string. There are no restrictions on the string format:
.nf ----
inproc://my_endpoint inproc://my_endpoint
inproc://feeds/opra/cboe inproc://feeds/opra/cboe
inproc://feeds.opra.nasdaq inproc://feeds.opra.nasdaq
inproc://!&W#($)_@_123*((^^^ inproc://!&W#($)_@_123*((^^^
.fi ----
.SH WIRE FORMAT
WIRE FORMAT
-----------
In-process transport transfers messages via memory thus there is no need for a In-process transport transfers messages via memory thus there is no need for a
wire format specification. wire format specification.
.SH "SEE ALSO"
.BR zmq_ipc (7) SEE ALSO
.BR zmq_tcp (7) --------
.BR zmq_udp (7) linkzmq:zmq_ipc[7]
.BR zmq_pgm (7) linkzmq:zmq_tcp[7]
linkzmq:zmq_udp[7]
linkzmq:zmq_pgm[7]
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_ipc 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_ipc(7)
.SH NAME ==========
0MQ IPC Transport \- transport to pass messages between processes
.SH SYNOPSIS
NAME
----
zmq_ipc - 0MQ transport to pass messages between processes
SYNOPSIS
--------
Inter-process transport is optimised for passing messages between processes on Inter-process transport is optimised for passing messages between processes on
the same physical machine. the same physical machine.
.SH CONNECTION STRING
CONNECTION STRING
-----------------
Connection string for inproc transport is "ipc://" followed by a file name. Connection string for inproc transport is "ipc://" followed by a file name.
The file will be used as placeholder for a message endpoint. (UNIX domain The file will be used as placeholder for a message endpoint. (UNIX domain
sockets associate a file with the listening socket in a similar way.) sockets associate a file with the listening socket in a similar way.)
.nf ----
ipc:///tmp/my_ipc_endpoint ipc:///tmp/my_ipc_endpoint
ipc:///tmp/prices.ipc ipc:///tmp/prices.ipc
.fi ----
.SH WIRE FORMAT
WIRE FORMAT
-----------
IPC transport doesn't transfer messages across the network thus there is no need IPC transport doesn't transfer messages across the network thus there is no need
for a wire format specification. for a wire format specification.
.SH "SEE ALSO"
.BR zmq_inproc (7) SEE ALSO
.BR zmq_tcp (7) --------
.BR zmq_udp (7) linkzmq:zmq_inproc[7]
.BR zmq_pgm (7) linkzmq:zmq_tcp[7]
linkzmq:zmq_udp[7]
linkzmq:zmq_pgm[7]
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
zmq_java(7)
===========
NAME
----
zmq_java - interface between 0MQ and Java applications
SYNOPSIS
--------
*
DESCRIPTION
-----------
*
SEE ALSO
--------
*
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_close 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_msg_close(3)
.SH NAME ================
zmq_msg_close \- destroys 0MQ message
.SH SYNOPSIS
.B int zmq_msg_close (zmq_msg_t *msg); NAME
.SH DESCRIPTION ----
Deallocates message zmq_msg_close - destroys 0MQ message
.IR msg
including any associated buffers (unless the buffer is
shared with another message). Not calling this function can result in SYNOPSIS
--------
'int zmq_msg_close (zmq_msg_t *msg);'
DESCRIPTION
-----------
Deallocates message 'msg' including any associated buffers (unless the buffer
is shared with another message). Not calling this function can result in
memory leaks. memory leaks.
.SH RETURN VALUE
In case of success the function returns zero. Otherwise it returns -1 and
sets RETURN VALUE
.IR errno ------------
to the appropriate value. In case of success the function returns zero. Otherwise it returns -1 and sets
.SH ERRORS 'errno' to the appropriate value.
ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_msg_t msg; zmq_msg_t msg;
rc = zmq_msg_init_size (&msg, 1000000); rc = zmq_msg_init_size (&msg, 1000000);
assert (rc = 0); assert (rc = 0);
rc = zmq_msg_close (&msg); rc = zmq_msg_close (&msg);
assert (rc = 0); assert (rc = 0);
.fi ----
.SH SEE ALSO
.BR zmq_msg_init (3)
.BR zmq_msg_init_size (3) SEE ALSO
.BR zmq_msg_init_data (3) --------
.SH AUTHOR linkzmq:zmq_msg_init[3]
linkzmq:zmq_msg_init_size[3]
linkzmq:zmq_msg_init_data[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_copy 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_msg_copy(3)
.SH NAME ===============
zmq_msg_copy \- copies content of a message to another message
.SH SYNOPSIS
.B int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); NAME
.SH DESCRIPTION ----
Copy the zmq_msg_copy - copies content of a message to another message
.IR src
message to
.IR dest . SYNOPSIS
The original content of --------
.IR dest 'int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);'
is orderly deallocated.
Caution: The implementation may choose not to physically copy the data, rather
DESCRIPTION
-----------
Copy the 'src' message to 'dest'. The original content of
'dest' is orderly deallocated.
CAUTION: The implementation may choose not to physically copy the data, rather
to share the buffer between two messages. Thus avoid modifying message data to share the buffer between two messages. Thus avoid modifying message data
after the message was copied. Doing so can modify multiple message instances. after the message was copied. Doing so can modify multiple message instances.
If what you need is actual hard copy, allocate new message using If what you need is actual hard copy, allocate new message using
.IR zmq_msg_size 'zmq_msg_size' and copy the data using 'memcpy'.
and copy the data using
.IR memcpy .
.SH RETURN VALUE RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_msg_t dest; zmq_msg_t dest;
rc = zmq_msg_init (&dest); rc = zmq_msg_init (&dest);
assert (rc == 0); assert (rc == 0);
rc = zmq_msg_copy (&dest, &src); rc = zmq_msg_copy (&dest, &src);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_msg_move (3)
.BR zmq_msg_init (3) SEE ALSO
.BR zmq_msg_init_size (3) --------
.BR zmq_msg_init_data (3) linkzmq:zmq_msg_move[3]
.BR zmq_msg_close (3) linkzmq:zmq_msg_init[3]
.SH AUTHOR linkzmq:zmq_msg_init_size[3]
linkzmq:zmq_msg_init_data[3]
linkzmq:zmq_msg_close[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_data 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_msg_data(3)
.SH NAME ===============
zmq_msg_data \- retrieves pointer to the message content
.SH SYNOPSIS
.B void *zmq_msg_data (zmq_msg_t *msg); NAME
.SH DESCRIPTION ----
zmq_msg_data - retrieves pointer to the message content
SYNOPSIS
--------
'void *zmq_msg_data (zmq_msg_t *msg);'
DESCRIPTION
-----------
Returns pointer to message data. Always use this function to access the data, Returns pointer to message data. Always use this function to access the data,
never use never use 'zmq_msg_t' members directly.
.IR zmq_msg_t
members directly.
.SH RETURN VALUE RETURN VALUE
------------
Pointer to the message data. Pointer to the message data.
.SH ERRORS
ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_msg_t msg; zmq_msg_t msg;
rc = zmq_msg_init_size (&msg, 100); rc = zmq_msg_init_size (&msg, 100);
memset (zmq_msg_data (&msg), 0, 100); memset (zmq_msg_data (&msg), 0, 100);
.fi ----
.SH SEE ALSO
.BR zmq_msg_init (3)
.BR zmq_msg_init_size (3) SEE ALSO
.BR zmq_msg_init_data (3) --------
.BR zmq_msg_close (3) linkzmq:zmq_msg_init[3]
.SH AUTHOR linkzmq:zmq_msg_init_size[3]
linkzmq:zmq_msg_init_data[3]
linkzmq:zmq_msg_close[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_init 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_msg_init(3)
.SH NAME ===============
zmq_msg_init \- initialises empty 0MQ message
.SH SYNOPSIS
.B int zmq_msg_init (zmq_msg_t *msg); NAME
.SH DESCRIPTION ----
zmq_msg_init - initialises empty 0MQ message
SYNOPSIS
--------
'int zmq_msg_init (zmq_msg_t *msg);'
DESCRIPTION
-----------
Initialises 0MQ message zero bytes long. The function is most useful Initialises 0MQ message zero bytes long. The function is most useful
to initialise a to initialise a 'zmq_msg_t' structure before receiving a message.
.IR zmq_msg_t
structure before receiving a message.
.SH RETURN VALUE RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_msg_t msg; zmq_msg_t msg;
rc = zmq_msg_init (&msg); rc = zmq_msg_init (&msg);
assert (rc == 0); assert (rc == 0);
rc = zmq_recv (s, &msg, 0); rc = zmq_recv (s, &msg, 0);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_msg_close (3)
.BR zmq_msg_init_size (3) SEE ALSO
.BR zmq_msg_init_data (3) --------
.BR zmq_msg_data (3) linkzmq:zmq_msg_close[3]
.BR zmq_msg_size (3) linkzmq:zmq_msg_init_size[3]
.SH AUTHOR linkzmq:zmq_msg_init_data[3]
linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_init_data 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_msg_init_data(3)
.SH NAME ====================
zmq_msg_init \- initialises 0MQ message from the given data
.SH SYNOPSIS
.nf NAME
.B typedef void (zmq_free_fn) (void *data, void *hint); ----
.B int zmq_msg_init_data (zmq_msg_t *msg, void *data, size_t size, zmq_free_fn *ffn, void *hint); zmq_msg_init_data - initialises 0MQ message from the given data
.fi
.SH DESCRIPTION
SYNOPSIS
--------
'typedef void (zmq_free_fn) (void *data, void *hint);'
'int zmq_msg_init_data (zmq_msg_t *msg, void *data, size_t size, zmq_free_fn *ffn, void *hint);'
DESCRIPTION
-----------
Initialise a message from a supplied buffer. Message isn't copied, Initialise a message from a supplied buffer. Message isn't copied,
instead 0MQ infrastructure takes ownership of the buffer located at address instead 0MQ infrastructure takes ownership of the buffer located at address
.IR data , 'data', 'size' bytes long. Deallocation function ('ffn') will be called once
.IR size the data are not needed anymore. When using a static constant buffer, 'ffn' may
bytes long. be NULL to prevent subsequent deallocation. If needed, additional 'hint' can be
Deallocation function ( passed to the initialisation function. It's an opaque pointer that will be
.IR ffn later on passed to 'ffn' as a second argument.
) will be called once the data are not needed anymore. When using a static
constant buffer,
.IR ffn RETURN VALUE
may be NULL to prevent subsequent deallocation. If needed, additional ------------
.IR hint
can be passed to the initialisation function. It's an opaque pointer that will
be later on passed to
.IR ffn
as a second argument.
.SH RETURN VALUE
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
void my_free (void *data, void *hint) {free (data);} void my_free (void *data, void *hint) {free (data);}
... ...
...@@ -44,12 +50,18 @@ rc = zmq_msg_init_data (&msg, data, 6, my_free, NULL); ...@@ -44,12 +50,18 @@ rc = zmq_msg_init_data (&msg, data, 6, my_free, NULL);
assert (rc == 0); assert (rc == 0);
rc = zmq_send (s, &msg, 0); rc = zmq_send (s, &msg, 0);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_msg_close (3)
.BR zmq_msg_init (3) SEE ALSO
.BR zmq_msg_init_size (3) --------
.BR zmq_msg_data (3) linkzmq:zmq_msg_close[3]
.BR zmq_msg_size (3) linkzmq:zmq_msg_init[3]
.SH AUTHOR linkzmq:zmq_msg_init_size[3]
linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
zmq_msg_init_size(3)
====================
NAME
----
zmq_msg_init_size - initialises 0MQ message of a specified size
SYNOPSIS
--------
'int zmq_msg_init_size (zmq_msg_t *msg, size_t size);'
DESCRIPTION
-----------
Initialises 0MQ message 'size' bytes long. The implementation chooses whether
it is more efficient to store message content on the stack (small messages) or
on the heap (large messages). Therefore, never access message data directly
via 'zmq_msg_t' members, rather use 'zmq_msg_data' and 'zmq_msg_size' functions
to get message data and size. Note that the message data are not nullified to
avoid the associated performance impact. Thus you should expect your message to
contain bogus data after this call.
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and
sets 'errno' to the appropriate value.
ERRORS
------
*ENOMEM*::
memory to hold the message cannot be allocated.
EXAMPLE
-------
----
zmq_msg_t msg;
rc = zmq_msg_init_size (&msg, 6);
assert (rc == 0);
memcpy (zmq_msg_data (&msg), "ABCDEF", 6);
rc = zmq_send (s, &msg, 0);
assert (rc == 0);
----
SEE ALSO
--------
linkzmq:zmq_msg_close[3]
linkzmq:zmq_msg_init[3]
linkzmq:zmq_msg_init_data[3]
linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
zmq_msg_move(3)
===============
NAME
----
zmq_msg_move - moves content of a message to another message
SYNOPSIS
--------
int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src);
DESCRIPTION
-----------
Move the content of the message from 'src' to 'dest'. The content isn't
copied, just moved. 'src' becomes an empty message after the call. Original
content of 'dest' message is deallocated.
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and
sets 'errno' to the appropriate value.
ERRORS
------
No errors are defined.
EXAMPLE
-------
----
zmq_msg_t dest;
rc = zmq_msg_init (&dest);
assert (rc == 0);
rc = zmq_msg_move (&dest, &src);
assert (rc == 0);
----
SEE ALSO
--------
linkzmq:zmq_msg_copy[3]
linkzmq:zmq_msg_init[3]
linkzmq:zmq_msg_init_size[3]
linkzmq:zmq_msg_init_data[3]
linkzmq:zmq_msg_close[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_size 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_msg_size(3)
.SH NAME ===============
zmq_msg_size \- retrieves size of the message content
.SH SYNOPSIS
.B size_t zmq_msg_size (zmq_msg_t *msg); NAME
.SH DESCRIPTION ----
zmq_msg_size - retrieves size of the message content
SYNOPSIS
--------
'size_t zmq_msg_size (zmq_msg_t *msg);'
DESCRIPTION
-----------
Returns size of the message data. Always use this function to get the size, Returns size of the message data. Always use this function to get the size,
never use never use 'zmq_msg_t' members directly.
.IR zmq_msg_t
members directly.
.SH RETURN VALUE RETURN VALUE
------------
Size of the message data (bytes). Size of the message data (bytes).
.SH ERRORS
ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_msg_t msg; zmq_msg_t msg;
rc = zmq_msg_init (&msg); rc = zmq_msg_init (&msg);
assert (rc == 0); assert (rc == 0);
rc = zmq_recv (s, &msg, 0); rc = zmq_recv (s, &msg, 0);
assert (rc == 0); assert (rc == 0);
size_t msg_size = zmq_msg_size (&msg); size_t msg_size = zmq_msg_size (&msg);
.fi ----
.SH SEE ALSO
.BR zmq_msg_init (3)
.BR zmq_msg_init_size (3) SEE ALSO
.BR zmq_msg_init_data (3) --------
.BR zmq_msg_close (3) linkzmq:zmq_msg_init[3]
.SH AUTHOR linkzmq:zmq_msg_init_size[3]
linkzmq:zmq_msg_init_data[3]
linkzmq:zmq_msg_close[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_pgm 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_pgm(7)
.SH NAME ==========
0MQ PGM Transport \- reliable multicast transport
.SH SYNOPSIS
NAME
----
zmq_pgm - 0MQ PGM reliable multicast transport
SYNOPSIS
--------
PGM is a protocol for reliable multicast (RFC3208). 0MQ's PGM transport allows PGM is a protocol for reliable multicast (RFC3208). 0MQ's PGM transport allows
you to deliver messages to multiple destinations sending the data over you to deliver messages to multiple destinations sending the data over
the network once only. It makes sense to use PGM transport if the data, the network once only. It makes sense to use PGM transport if the data,
...@@ -18,40 +24,41 @@ socket option. ...@@ -18,40 +24,41 @@ socket option.
PGM transport can be used only with ZMQ_PUB and ZMQ_SUB sockets. PGM transport can be used only with ZMQ_PUB and ZMQ_SUB sockets.
Caution: PGM protocol runs directly on top of IP protocol and thus needs to CAUTION: PGM protocol runs directly on top of IP protocol and thus needs to
open raw IP socket. On some operating systems this operation requires special open raw IP socket. On some operating systems this operation requires special
privileges. On Linux, for example, you would need to either run your application privileges. On Linux, for example, you would need to either run your application
as root or set adequate capabilities for your executable. Alternative approach as root or set adequate capabilities for your executable. Alternative approach
is to use UDP transport, is to use UDP transport, linkzmq:zmq_udp[7], that stacks PGM on top of UDP and
.IR zmq_udp(7) , thus needs no special privileges.
that stacks PGM on top of UDP and thus needs no special privileges.
.SH CONNECTION STRING
CONNECTION STRING
-----------------
Connection string for PGM transport is "pgm://" followed by an IP address Connection string for PGM transport is "pgm://" followed by an IP address
of the NIC to use, semicolon, IP address of the multicast group, colon and of the NIC to use, semicolon, IP address of the multicast group, colon and
port number. IP address of the NIC can be either its numeric representation port number. IP address of the NIC can be either its numeric representation
or the name of the NIC as reported by operating system. IP address of the or the name of the NIC as reported by operating system. IP address of the
multicast group should be specified in the numeric representation. For example: multicast group should be specified in the numeric representation. For example:
.nf ----
pgm://eth0;224.0.0.1:5555 pgm://eth0;224.0.0.1:5555
pgm://lo;230.0.0.0:6666 pgm://lo;230.0.0.0:6666
pgm://192.168.0.111;224.0.0.1:5555 pgm://192.168.0.111;224.0.0.1:5555
.fi ----
Note that NIC names are not standardised by POSIX. They tend to be rather NOTE: NIC names are not standardised by POSIX. They tend to be rather arbitrary
arbitrary and platform dependent. Say, "eth0" on Linux would correspond to "en0" and platform dependent. Say, "eth0" on Linux would correspond to "en0" on OSX
on OSX and "e1000g" on Solaris. On Windows platform, as there are no short NIC and "e1000g" on Solaris. On Windows platform, as there are no short NIC names
names available, you have to use numeric IP addresses instead. available, you have to use numeric IP addresses instead.
.SH WIRE FORMAT
WIRE FORMAT
-----------
Consecutive PGM packets are interpreted as a single continuous stream of data. Consecutive PGM packets are interpreted as a single continuous stream of data.
The data is then split into messages using the wire format described in The data is then split into messages using the wire format described in
.IR zmq_tcp(7) . linkzmq:zmq_tcp[7]. Thus, messages are not aligned with packet boundaries and
Thus, messages are not aligned with packet boundaries and each message can start each message can start at an arbitrary position within the packet and span
at an arbitrary position within the packet and span several packets. several packets.
Given this wire format, it would be impossible for late joining consumers to Given this wire format, it would be impossible for late joining consumers to
identify message boundaries. To solve this problem, each PGM packet payload identify message boundaries. To solve this problem, each PGM packet payload
...@@ -62,15 +69,15 @@ the value of the initial integer is 0xFFFF. ...@@ -62,15 +69,15 @@ the value of the initial integer is 0xFFFF.
Each packet thus looks like this: Each packet thus looks like this:
.nf ----
+-----------+------------+------------------+-------- +-----------+------------+------------------+--------
| IP header | PGM header | offset (16 bits) | data ..... | IP header | PGM header | offset (16 bits) | data .....
+-----------+------------+------------------+-------- +-----------+------------+------------------+--------
.fi ----
Following example shows how messages are arranged in subsequent packets: Following example shows how messages are arranged in subsequent packets:
.nf ----
+---------------+--------+-----------+-----------------------------+ +---------------+--------+-----------+-----------------------------+
| PGM/IPheaders | 0x0000 | message 1 | message 2 (part 1) | | PGM/IPheaders | 0x0000 | message 1 | message 2 (part 1) |
+---------------+--------+-----------+-----------------------------+ +---------------+--------+-----------+-----------------------------+
...@@ -82,17 +89,18 @@ Following example shows how messages are arranged in subsequent packets: ...@@ -82,17 +89,18 @@ Following example shows how messages are arranged in subsequent packets:
+---------------+--------+--------------------------+-----------+ +---------------+--------+--------------------------+-----------+
| PGM/IPheaders | 0x0008 | message 2 (last 8 bytes) | message 3 | | PGM/IPheaders | 0x0008 | message 2 (last 8 bytes) | message 3 |
+---------------+--------+--------------------------+-----------+ +---------------+--------+--------------------------+-----------+
.fi ----
.SH "SEE ALSO"
.BR zmq_udp (7) SEE ALSO
.BR zmq_tcp (7) --------
.BR zmq_ipc (7) linkzmq:zmq_udp[7]
.BR zmq_inproc (7) linkzmq:zmq_tcp[7]
.BR zmq_setsockopt (3) linkzmq:zmq_ipc[7]
linkzmq:zmq_inproc[7]
.SH AUTHOR linkzmq:zmq_setsockopt[3]
Martin Sustrik <sustrik at 250bpm dot com>
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_poll 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_poll(3)
.SH NAME ===========
zmq_poll \- polls for events on a set of 0MQ and POSIX sockets
.SH SYNOPSIS
.B int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); NAME
.SH DESCRIPTION ----
Waits for the events specified by zmq_poll - polls for events on a set of 0MQ and POSIX sockets
.IR items
parameter. Number of items in the array is determined by
.IR nitems SYNOPSIS
argument. Each item in the array looks like this: --------
'int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);'
.nf
DESCRIPTION
-----------
Waits for the events specified by 'items' parameter. Number of items in the
array is determined by 'nitems' argument. Each item in the array looks like
this:
----
typedef struct typedef struct
{ {
void *socket; void *socket;
...@@ -18,43 +26,43 @@ typedef struct ...@@ -18,43 +26,43 @@ typedef struct
short events; short events;
short revents; short revents;
} zmq_pollitem_t; } zmq_pollitem_t;
.fi ----
0MQ socket to poll on is specified by 0MQ socket to poll on is specified by 'socket'. In case you want to poll on
.IR socket . standard POSIX socket, set 'socket' to NULL and fill the POSIX file descriptor
In case you want to poll on standard POSIX socket, set to 'fd'. 'events' specifies which events to wait for. It's a combination of
.IR socket the values below. Once the call exits, 'revents' will be filled with events
to NULL and fill the POSIX file descriptor to that have actually occured on the socket. The field will contain a combination
.IR fd . of the values below.
.IR events
specifies which events to wait for. It's a combination of the values below. *ZMQ_POLLIN*::
Once the call exits,
.IR revent
will be filled with events that have actually occured on the socket. The field
will contain a combination of the values below.
.IP "\fBZMQ_POLLIN\fP"
poll for incoming messages. poll for incoming messages.
.IP "\fBZMQ_POLLOUT\fP" *ZMQ_POLLOUT*::
wait while message can be set socket. Poll will return if a message of at least wait while message can be set socket. Poll will return if a message of at least
one byte can be written to the socket. However, there is no guarantee that one byte can be written to the socket. However, there is no guarantee that
arbitrarily large message can be sent. arbitrarily large message can be sent.
.IR timeout 'timeout' argument specifies an upper limit on the time for which 'zmq_poll'
argument specifies an upper limit on the time for which will block, in microseconds. Specifying a negative value in timeout means an
.IR zmq_poll infinite timeout.
will block, in microseconds. Specifying a negative value in timeout means
an infinite timeout.
.SH RETURN VALUE
RETURN VALUE
------------
Function returns number of items signaled or -1 in the case of error. Function returns number of items signaled or -1 in the case of error.
.SH ERRORS
.IP "\fBEFAULT\fP"
ERRORS
------
*EFAULT*::
there's a 0MQ socket in the pollset belonging to a different application thread. there's a 0MQ socket in the pollset belonging to a different application thread.
.IP "\fBENOTSUP\fP" *ENOTSUP*::
0MQ context was initialised without ZMQ_POLL flag. I/O multiplexing is disabled. 0MQ context was initialised without ZMQ_POLL flag. I/O multiplexing is disabled.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_pollitem_t items [2]; zmq_pollitem_t items [2];
items [0].socket = s; items [0].socket = s;
items [0].events = ZMQ_POLLIN; items [0].events = ZMQ_POLLIN;
...@@ -64,8 +72,14 @@ items [1].events = ZMQ_POLLIN; ...@@ -64,8 +72,14 @@ items [1].events = ZMQ_POLLIN;
int rc = zmq_poll (items, 2); int rc = zmq_poll (items, 2);
assert (rc != -1); assert (rc != -1);
.fi ----
.SH SEE ALSO
.BR zmq_socket (3)
.SH AUTHOR SEE ALSO
--------
linkzmq:zmq_socket[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
zmq_python(7)
=============
NAME
----
zmq_python - interface between 0MQ and Python applications
SYNOPSIS
--------
*
DESCRIPTION
-----------
*
SEE ALSO
--------
*
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
zmq_queue(1)
============
NAME
----
zmq_queue - forwards REQ/REP messages
SYNOPSIS
--------
*
DESCRIPTION
-----------
*
OPTIONS
-------
*
SEE ALSO
--------
*
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_recv 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_recv(3)
.SH NAME ===========
zmq_recv \- retrieves a message from the socket
.SH SYNOPSIS
.B int zmq_recv (void *s, zmq_msg_t *msg, int flags); NAME
.SH DESCRIPTION ----
Receive a message from the socket zmq_recv - retrieves a message from the socket
.IR s ,
store it in
.IR msg . SYNOPSIS
Any content previously in --------
.IR msg 'int zmq_recv (void *s, zmq_msg_t *msg, int flags);'
will be properly deallocated.
.IR flags
DESCRIPTION
-----------
Receive a message from the socket 's', store it in
'msg' . Any content previously in 'msg' will be properly deallocated. 'flags'
argument can be combination of the flags described below. argument can be combination of the flags described below.
.IP "\fBZMQ_NOBLOCK\fP" *ZMQ_NOBLOCK*::
The flag specifies that the operation should be performed in The flag specifies that the operation should be performed in
non-blocking mode. I.e. if it cannot be processed immediately, non-blocking mode. I.e. if it cannot be processed immediately,
error should be returned with error should be returned with 'errno' set to EAGAIN.
.IR errno
set to EAGAIN.
.SH RETURN VALUE
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
.IP "\fBEAGAIN\fP" ------
*EAGAIN*::
it's a non-blocking receive and there's no message available at the moment. it's a non-blocking receive and there's no message available at the moment.
.IP "\fBENOTSUP\fP" *ENOTSUP*::
function isn't supported by particular socket type. function isn't supported by particular socket type.
.IP "\fBEFSM\fP" *EFSM*::
function cannot be called at the moment, because socket is not in the function cannot be called at the moment, because socket is not in the
appropriate state. This error may occur with sockets that switch between appropriate state. This error may occur with sockets that switch between
several states (e.g. ZMQ_REQ). several states (e.g. ZMQ_REQ).
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_msg_t msg; zmq_msg_t msg;
int rc = zmq_msg_init (&msg); int rc = zmq_msg_init (&msg);
assert (rc == 0); assert (rc == 0);
rc = zmq_recv (s, &msg, 0); rc = zmq_recv (s, &msg, 0);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_send (3)
.BR zmq_msg_init (3) SEE ALSO
.BR zmq_msg_data (3) --------
.BR zmq_msg_size (3) linkzmq:zmq_send[3]
.SH AUTHOR linkzmq:zmq_msg_init[3]
linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_send 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_send(3)
.SH NAME ===========
zmq_send \- sends a message
.SH SYNOPSIS
.B int zmq_send (void *s, zmq_msg_t *msg, int flags); NAME
.SH DESCRIPTION ----
Send the message zmq_send - sends a message
.IR msg
to the socket
.IR s . SYNOPSIS
.IR flags --------
argument can be combination the flags described below. 'int zmq_send (void *s, zmq_msg_t *msg, int flags);'
.IP "\fBZMQ_NOBLOCK\fP"
The flag specifies that the operation should be performed in DESCRIPTION
non-blocking mode. I.e. if it cannot be processed immediately, -----------
error should be returned with Send the message 'msg' to the socket 's'. 'flags' argument can be combination
.IR errno the flags described below.
set to EAGAIN.
*ZMQ_NOBLOCK*::
.IP "\fBZMQ_NOFLUSH\fP" The flag specifies that the operation should be performed in non-blocking mode.
The flag specifies that I.e. if it cannot be processed immediately, error should be returned with
.IR zmq_send 'errno' set to EAGAIN.
should not flush the message downstream immediately. Instead, it should batch
ZMQ_NOFLUSH messages and send them downstream only once *ZMQ_NOFLUSH*::
.IR zmq_flush The flag specifies that 'zmq_send' should not flush the message downstream
is invoked. This is an optimisation for cases where several messages are sent immediately. Instead, it should batch ZMQ_NOFLUSH messages and send them
in a single business transaction. However, the effect is measurable only in downstream only once 'zmq_flush' is invoked. This is an optimisation for cases
extremely high-perf scenarios (million messages a second or so). where several messages are sent in a single business transaction. However, the
If that's not your case, use standard flushing send instead. effect is measurable only in extremely high-perf scenarios (million messages a
second or so). If that's not your case, use standard flushing send instead.
.SH RETURN VALUE
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
.IP "\fBEAGAIN\fP" ------
*EAGAIN*::
it's a non-blocking send and message cannot be sent at the moment. it's a non-blocking send and message cannot be sent at the moment.
.IP "\fBENOTSUP\fP" *ENOTSUP*::
function isn't supported by particular socket type. function isn't supported by particular socket type.
.IP "\fBEFSM\fP" *EFSM*::
function cannot be called at the moment, because socket is not in the function cannot be called at the moment, because socket is not in the
appropriate state. This error may occur with sockets that switch between appropriate state. This error may occur with sockets that switch between
several states (e.g. ZMQ_REQ). several states (e.g. ZMQ_REQ).
.SH EXAMPLE
.nf
EXAMPLE
-------
----
zmq_msg_t msg; zmq_msg_t msg;
int rc = zmq_msg_init_size (&msg, 6); int rc = zmq_msg_init_size (&msg, 6);
assert (rc == 0); assert (rc == 0);
memset (zmq_msg_data (&msg), 'A', 6); memset (zmq_msg_data (&msg), 'A', 6);
rc = zmq_send (s, &msg, 0); rc = zmq_send (s, &msg, 0);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_flush (3)
.BR zmq_recv (3) SEE ALSO
.BR zmq_msg_init (3) --------
.BR zmq_msg_init_size (3) linkzmq:zmq_flush[3]
.BR zmq_msg_init_data (3) linkzmq:zmq_recv[3]
.BR zmq_msg_data (3) linkzmq:zmq_msg_init[3]
.BR zmq_msg_size (3) linkzmq:zmq_msg_init_size[3]
.SH AUTHOR linkzmq:zmq_msg_init_data[3]
linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_setsockopt 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_setsockopt(3)
.SH NAME =================
zmq_setsockopt \- sets a specified option on a 0MQ socket
.SH SYNOPSIS
.B int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen); NAME
.SH DESCRIPTION ----
Sets an option on the socket.
.IR option zmq_setsockopt - sets a specified option on a 0MQ socket
argument specifies the option from the list below.
.IR optval
is a pointer to the value to set, SYNOPSIS
.IR optvallen --------
is the size of the value in bytes. 'int zmq_setsockopt (void *s, int option, const void *optval, size_t optvallen);'
.IP "\fBZMQ_HWM\fP"
DESCRIPTION
-----------
Sets an option on the socket. 'option' argument specifies the option from the
list below. 'optval' is a pointer to the value to set, 'optvallen' is the size
of the value in bytes.
*ZMQ_HWM*::
High watermark for the message pipes associated with the socket. The water High watermark for the message pipes associated with the socket. The water
mark cannot be exceeded. If the messages don't fit into the pipe emergency mark cannot be exceeded. If the messages don't fit into the pipe emergency
mechanisms of the particular socket type are used (block, drop etc.) If HWM mechanisms of the particular socket type are used (block, drop etc.) If HWM
is set to zero, there are no limits for the content of the pipe. is set to zero, there are no limits for the content of the pipe.
+
Type: int64_t Unit: messages Default: 0 Type: int64_t Unit: messages Default: 0
.IP "\fBZMQ_LWM\fP" *ZMQ_LWM*::
Low watermark makes sense only if high watermark is defined (i.e. is non-zero). Low watermark makes sense only if high watermark is defined (i.e. is non-zero).
When the emergency state is reached when messages overflow the pipe, the When the emergency state is reached when messages overflow the pipe, the
emergency lasts at most till the size of the pipe decreases to low watermark. emergency lasts at most till the size of the pipe decreases to low watermark.
Normal state is resumed at that point. Normal state is resumed at that point.
+
Type: int64_t Unit: messages Default: 0 Type: int64_t Unit: messages Default: 0
.IP "\fBZMQ_SWAP\fP" *ZMQ_SWAP*::
Swap allows the pipe to exceed high watermark. However, the data are written Swap allows the pipe to exceed high watermark. However, the data are written
to the disk rather than held in the memory. Until high watermark is to the disk rather than held in the memory. Until high watermark is
exceeded there is no disk activity involved though. The value of the option exceeded there is no disk activity involved though. The value of the option
defines maximal size of the swap file. defines maximal size of the swap file.
+
Type: int64_t Unit: bytes Default: 0 Type: int64_t Unit: bytes Default: 0
.IP "\fBZMQ_AFFINITY\fP" *ZMQ_AFFINITY*::
Affinity defines which threads in the thread pool will be used to handle Affinity defines which threads in the thread pool will be used to handle
newly created sockets. This way you can dedicate some of the threads (CPUs) newly created sockets. This way you can dedicate some of the threads (CPUs)
to a specific work. Value of 0 means no affinity. Work is distributed to a specific work. Value of 0 means no affinity. Work is distributed
...@@ -44,94 +51,105 @@ fairly among the threads in the thread pool. For non-zero values, the lowest ...@@ -44,94 +51,105 @@ fairly among the threads in the thread pool. For non-zero values, the lowest
bit corresponds to the thread 1, second lowest bit to the thread 2 etc. bit corresponds to the thread 1, second lowest bit to the thread 2 etc.
Thus, value of 3 means that from now on newly created sockets will handle Thus, value of 3 means that from now on newly created sockets will handle
I/O activity exclusively using threads no. 1 and 2. I/O activity exclusively using threads no. 1 and 2.
+
Type: int64_t Unit: N/A (bitmap) Default: 0 Type: int64_t Unit: N/A (bitmap) Default: 0
.IP "\fBZMQ_IDENTITY\fP" *ZMQ_IDENTITY*::
Identity of the socket. Identity is important when restarting applications. Identity of the socket. Identity is important when restarting applications.
If the socket has no identity, each run of the application is completely If the socket has no identity, each run of the application is completely
separated from other runs. However, with identity application reconnects to separated from other runs. However, with identity application reconnects to
existing infrastructure left by the previous run. Thus it may receive existing infrastructure left by the previous run. Thus it may receive
messages that were sent in the meantime, it shares pipe limits with the messages that were sent in the meantime, it shares pipe limits with the
previous run etc. previous run etc.
+
Type: string Unit: N/A Default: NULL Type: string Unit: N/A Default: NULL
.IP "\fBZMQ_SUBSCRIBE\fP" *ZMQ_SUBSCRIBE*::
Applicable only to ZMQ_SUB socket type. It establishes new message filter. Applicable only to ZMQ_SUB socket type. It establishes new message filter.
When ZMQ_SUB socket is created all the incoming messages are filtered out. When ZMQ_SUB socket is created all the incoming messages are filtered out.
This option allows you to subscribe for all messages (""), or messages This option allows you to subscribe for all messages (""), or messages
beginning with specific prefix (e.g. "animals.mammals.dogs."). Multiple beginning with specific prefix (e.g. "animals.mammals.dogs."). Multiple
filters can be attached to a single 'sub' socket. In that case message passes filters can be attached to a single 'sub' socket. In that case message passes
if it matches at least one of the filters. if it matches at least one of the filters.
+
Type: string Unit: N/A Default: N/A Type: string Unit: N/A Default: N/A
.IP "\fBZMQ_UNSUBSCRIBE\fP" *ZMQ_UNSUBSCRIBE*::
Applicable only to ZMQ_SUB socket type. Removes existing message filter. Applicable only to ZMQ_SUB socket type. Removes existing message filter.
The filter specified must match the string passed to ZMQ_SUBSCRIBE options The filter specified must match the string passed to ZMQ_SUBSCRIBE options
exactly. If there were several instances of the same filter created, exactly. If there were several instances of the same filter created,
this options removes only one of them, leaving the rest in place this options removes only one of them, leaving the rest in place
and functional. and functional.
+
Type: string Unit: N/A Default: N/A Type: string Unit: N/A Default: N/A
.IP "\fBZMQ_RATE\fP" *ZMQ_RATE*::
This option applies only to sending side of multicast transports (pgm & udp). This option applies only to sending side of multicast transports (pgm & udp).
It specifies maximal outgoing data rate that an individual sender socket It specifies maximal outgoing data rate that an individual sender socket
can send. can send.
+
Type: uint64_t Unit: kilobits/second Default: 100 Type: uint64_t Unit: kilobits/second Default: 100
.IP "\fBZMQ_RECOVERY_IVL\fP" *ZMQ_RECOVERY_IVL*::
This option applies only to multicast transports (pgm & udp). It specifies This option applies only to multicast transports (pgm & udp). It specifies
how long can the receiver socket survive when the sender is inaccessible. how long can the receiver socket survive when the sender is inaccessible.
Keep in mind that large recovery intervals at high data rates result in Keep in mind that large recovery intervals at high data rates result in
very large recovery buffers, meaning that you can easily overload your box very large recovery buffers, meaning that you can easily overload your box
by setting say 1 minute recovery interval at 1Gb/s rate (requires by setting say 1 minute recovery interval at 1Gb/s rate (requires
7GB in-memory buffer). 7GB in-memory buffer).
+
Type: uint64_t Unit: seconds Default: 10 Type: uint64_t Unit: seconds Default: 10
.IP "\fBZMQ_MCAST_LOOP\fP" *ZMQ_MCAST_LOOP*::
This option applies only to multicast transports (pgm & udp). Value of 1 This option applies only to multicast transports (pgm & udp). Value of 1
means that the mutlicast packets can be received on the box they were sent means that the mutlicast packets can be received on the box they were sent
from. Setting the value to 0 disables the loopback functionality which from. Setting the value to 0 disables the loopback functionality which
can have negative impact on the performance. If possible, disable can have negative impact on the performance. If possible, disable
the loopback in production environments. the loopback in production environments.
+
Type: uint64_t Unit: N/A (boolean value) Default: 1 Type: uint64_t Unit: N/A (boolean value) Default: 1
.IP "\fBZMQ_SNDBUF\fP" *ZMQ_SNDBUF*::
Sets the underlying kernel transmit buffer size to the specified size. See Sets the underlying kernel transmit buffer size to the specified size. See
.IR SO_SNDBUF 'SO_SNDBUF' POSIX socket option. Value of zero means leaving the OS default
POSIX socket option. Value of zero means leaving the OS default unchanged. unchanged.
+
Type: uint64_t Unit: bytes Default: 0 Type: uint64_t Unit: bytes Default: 0
.IP "\fBZMQ_RCVBUF\fP" *ZMQ_RCVBUF*::
Sets the underlying kernel receive buffer size to the specified size. See Sets the underlying kernel receive buffer size to the specified size. See
.IR SO_RCVBUF 'SO_RCVBUF' POSIX socket option. Value of zero means leaving the OS default
POSIX socket option. Value of zero means leaving the OS default unchanged. unchanged.
+
Type: uint64_t Unit: bytes Default: 0 Type: uint64_t Unit: bytes Default: 0
.SH RETURN VALUE
RETURN VALUE
------------
In case of success the function returns zero. Otherwise it returns -1 and In case of success the function returns zero. Otherwise it returns -1 and
sets sets 'errno' to the appropriate value.
.IR errno
to the appropriate value.
.SH ERRORS ERRORS
.IP "\fBEINVAL\fP" ------
*EINVAL*::
unknown option, a value with incorrect length or invalid value. unknown option, a value with incorrect length or invalid value.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
int rc = zmq_setsockopt (s, ZMQ_SUBSCRIBE, "", 0); int rc = zmq_setsockopt (s, ZMQ_SUBSCRIBE, "", 0);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_socket (3)
.BR zmq (7) SEE ALSO
--------
linkzmq:zmq_socket[3]
linkzmq:zmq[7]
.SH AUTHOR AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_socket 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_socket(3)
.SH NAME =============
zmq_socket \- creates 0MQ socket
.SH SYNOPSIS
.B void *zmq_socket (void *context, int type);
.SH DESCRIPTION
Open a socket within the specified
.IR context .
To create a context, use
.IR zmq_init
function.
.IR type
argument can be one of the values defined below. Note that each socket is owned
by exactly one thread (the one that it was created from) and should not be used
from any other thread.
.IP "\fBZMQ_P2P\fP"
Socket to communicate with a single peer. Allows for only a single connect or a
single bind. There's no message routing or message filtering involved.
NAME
----
zmq_socket - creates 0MQ socket
SYNOPSIS
--------
'void *zmq_socket (void *context, int type);'
DESCRIPTION
-----------
Open a socket within the specified 'context'. To create a context, use
'zmq_init' function. 'type' argument can be one of the values defined below.
Note that each socket is owned by exactly one thread (the one that it was
created from) and should not be used from any other thread.
*ZMQ_P2P*::
Socket to communicate with a single peer. Allows for only a single connect
or a single bind. There's no message routing or message filtering involved.
+
Compatible peer sockets: ZMQ_P2P. Compatible peer sockets: ZMQ_P2P.
.IP "\fBZMQ_PUB\fP" *ZMQ_PUB*::
Socket to distribute data. Recv function is not implemented for this socket Socket to distribute data. Recv function is not implemented for this socket
type. Messages are distributed in fanout fashion to all the peers. type. Messages are distributed in fanout fashion to all the peers.
+
Compatible peer sockets: ZMQ_SUB. Compatible peer sockets: ZMQ_SUB.
.IP "\fBZMQ_SUB\fP" *ZMQ_SUB*::
Socket to subscribe for data. Send function is not implemented for this Socket to subscribe for data. Send function is not implemented for this socket
socket type. Initially, socket is subscribed for no messages. Use ZMQ_SUBSCRIBE type. Initially, socket is subscribed for no messages. Use ZMQ_SUBSCRIBE option
option to specify which messages to subscribe for. to specify which messages to subscribe for.
+
Compatible peer sockets: ZMQ_PUB. Compatible peer sockets: ZMQ_PUB.
.IP "\fBZMQ_REQ\fP" *ZMQ_REQ*::
Socket to send requests and receive replies. Requests are load-balanced among Socket to send requests and receive replies. Requests are load-balanced among
all the peers. This socket type allows only an alternated sequence of all the peers. This socket type allows only an alternated sequence of send's
send's and recv's. and recv's.
+
Compatible peer sockets: ZMQ_REP, ZMQ_XREP. Compatible peer sockets: ZMQ_REP, ZMQ_XREP.
.IP "\fBZMQ_REP\fP" *ZMQ_REP*::
Socket to receive requests and send replies. This socket type allows Socket to receive requests and send replies. This socket type allows only an
only an alternated sequence of recv's and send's. Each send is routed to alternated sequence of recv's and send's. Each send is routed to the peer that
the peer that issued the last received request. issued the last received request.
+
Compatible peer sockets: ZMQ_REQ, ZMQ_XREQ. Compatible peer sockets: ZMQ_REQ, ZMQ_XREQ.
.IP "\fBZMQ_XREQ\fP" *ZMQ_XREQ*::
Special socket type to be used in request/reply middleboxes such as Special socket type to be used in request/reply middleboxes such as
.BR zmq_queue(7) . linkzmq:zmq_queue[7]. Requests forwarded using this socket type should be
Requests forwarded using this socket type should be tagged by a proper prefix tagged by a proper prefix identifying the original requester. Replies received
identifying the original requester. Replies received by this socket are tagged by this socket are tagged with a proper postfix that can be use to route the
with a proper postfix that can be use to route the reply back to the original reply back to the original requester.
requester. +
Compatible peer sockets: ZMQ_REP, ZMQ_XREP. Compatible peer sockets: ZMQ_REP, ZMQ_XREP.
.IP "\fBZMQ_XREP\fP" *ZMQ_XREP*::
Special socket type to be used in request/reply middleboxes such as Special socket type to be used in request/reply middleboxes such as
.BR zmq_queue(7) . linkzmq:zmq_queue[7]. Requests received using this socket are already properly
Requests received using this socket are already properly tagged with prefix tagged with prefix identifying the original requester. When sending a reply via
identifying the original requester. When sending a reply via XREP socket the XREP socket the message should be tagged with a prefix from a corresponding
message should be tagged with a prefix from a corresponding request. request.
+
Compatible peer sockets: ZMQ_REQ, ZMQ_XREQ. Compatible peer sockets: ZMQ_REQ, ZMQ_XREQ.
.IP "\fBZMQ_UPSTREAM\fP" *ZMQ_UPSTREAM*::
Socket to receive messages from up the stream. Messages are fair-queued Socket to receive messages from up the stream. Messages are fair-queued from
from among all the connected peers. Send function is not implemented for among all the connected peers. Send function is not implemented for this socket
this socket type. type.
+
Compatible peer sockets: ZMQ_DOWNSTREAM. Compatible peer sockets: ZMQ_DOWNSTREAM.
.IP "\fBZMQ_DOWNSTREAM\fP" *ZMQ_DOWNSTREAM*::
Socket to send messages down stream. Messages are load-balanced among all the Socket to send messages down stream. Messages are load-balanced among all the
connected peers. Recv function is not implemented for this socket type. connected peers. Recv function is not implemented for this socket type.
+
Compatible peer sockets: ZMQ_UPSTREAM. Compatible peer sockets: ZMQ_UPSTREAM.
.SH RETURN VALUE
RETURN VALUE
------------
Function returns socket handle is successful. Otherwise it returns NULL and Function returns socket handle is successful. Otherwise it returns NULL and
sets errno to one of the values below. sets errno to one of the values below.
.SH ERRORS
.IP "\fBEINVAL\fP"
invalid socket type. ERRORS
.IP "\fBEMTHREAD\fP" ------
the number of application threads allowed to own 0MQ sockets was exceeded. See *EINVAL*::
.IR app_threads invalid socket type.
parameter to
.IR zmq_init *EMTHREAD*::
function. the number of application threads allowed to own 0MQ sockets was exceeded.
.SH EXAMPLE See 'app_threads' parameter to 'zmq_init' function.
.nf
EXAMPLE
-------
----
void *s = zmq_socket (context, ZMQ_PUB); void *s = zmq_socket (context, ZMQ_PUB);
assert (s); assert (s);
int rc = zmq_bind (s, "tcp://192.168.0.1:5555"); int rc = zmq_bind (s, "tcp://192.168.0.1:5555");
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_init (3)
.BR zmq_setsockopt (3) SEE ALSO
.BR zmq_bind (3) --------
.BR zmq_connect (3) linkzmq:zmq_init[3]
.BR zmq_send (3) linkzmq:zmq_setsockopt[3]
.BR zmq_flush (3) linkzmq:zmq_bind[3]
.BR zmq_recv (3) linkzmq:zmq_connect[3]
.SH AUTHOR linkzmq:zmq_send[3]
linkzmq:zmq_flush[3]
linkzmq:zmq_recv[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
zmq_streamer(1)
===============
NAME
----
zmq_streamer - forwards the stream of UPSTREAM/DOWNSTREAM messages
SYNOPSIS
--------
*
DESCRIPTION
-----------
*
OPTIONS
-------
*
SEE ALSO
--------
*
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_strerror 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_strerror(3)
.SH NAME ===============
zmq_strerror \- returns string describing the error number
.SH SYNOPSIS
.B const char *zmq_strerror (int errnum); NAME
.SH DESCRIPTION ----
zmq_strerror - returns string describing the error number
SYNOPSIS
--------
'const char *zmq_strerror (int errnum);'
DESCRIPTION
-----------
As 0MQ defines few additional (non-POSIX) error codes, standard As 0MQ defines few additional (non-POSIX) error codes, standard
.IR strerror 'strerror' isn't capable of translating those errors into human readable
isn't capable of translating those errors into human readable strings. Instead, strings. Instead, 'zmq_strerror' should be used.
.IR zmq_strerror
should be used.
.SH RETURN VALUE RETURN VALUE
------------
Returns string describing the error number. Returns string describing the error number.
.SH ERRORS
ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
void *ctx = zmq_init (1, 1, 0); void *ctx = zmq_init (1, 1, 0);
if (!ctx) { if (!ctx) {
printf ("error occured during zmq_init: %s\\n", zmq_strerror (errno)); printf ("error occured during zmq_init: %s\\n", zmq_strerror (errno));
abort (); abort ();
} }
.fi ----
.SH SEE ALSO
.BR zmq (7)
.SH AUTHOR SEE ALSO
--------
linkzmq:zmq[7]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_tcp 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_tcp(7)
.SH NAME ==========
0MQ TCP Transport \- unicast transport over the network
.SH SYNOPSIS
NAME
----
zmq_tcp - 0MQ unicast TCP transport over the network
SYNOPSIS
--------
TCP is an ubiquitous unicast transport. When connecting distributed TCP is an ubiquitous unicast transport. When connecting distributed
applications, you will mostly use TCP transport. applications, you will mostly use TCP transport.
.SH CONNECTION STRING
CONNECTION STRING
-----------------
Connection string for TCP transport is "tcp://" followed by an IP address, Connection string for TCP transport is "tcp://" followed by an IP address,
colon and port number. IP address can be either its numeric representation, colon and port number. IP address can be either its numeric representation,
a NIC name or a hostname (resolved by DNS): a NIC name or a hostname (resolved by DNS):
.nf ----
tcp://192.168.0.111:5555 tcp://192.168.0.111:5555
tcp://myserver001:80 tcp://myserver001:80
tcp://lo:32768 tcp://lo:32768
.fi ----
Note that NIC names are not standardised by POSIX. They tend to be rather Note that NIC names are not standardised by POSIX. They tend to be rather
arbitrary and platform dependent. Say, "eth0" on Linux would correspond to "en0" arbitrary and platform dependent. Say, "eth0" on Linux would correspond to "en0"
on OSX and "e1000g" on Solaris. On Windows platform, as there are no short NIC on OSX and "e1000g" on Solaris. On Windows platform, as there are no short NIC
names available, you have to use numeric IP addresses instead. names available, you have to use numeric IP addresses instead.
.SH WIRE FORMAT
WIRE FORMAT
-----------
A message consists of a message length followed by message data. A message consists of a message length followed by message data.
Size of message data MUST correspond to the message length. Size of message data MUST correspond to the message length.
...@@ -35,16 +43,16 @@ For messages of 255 or more octets the length is represented by a single octet ...@@ -35,16 +43,16 @@ For messages of 255 or more octets the length is represented by a single octet
The protocol can be defined by this BNF grammar: The protocol can be defined by this BNF grammar:
.nf ----
frame = length data frame = length data
length = OCTET | escape 8*OCTET length = OCTET | escape 8*OCTET
escape = %xFF escape = %xFF
data = *OCTET data = *OCTET
.fi ----
Binary layout of a message (up to 254 bytes long): Binary layout of a message (up to 254 bytes long):
.nf ----
0 1 2 3 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
...@@ -52,9 +60,11 @@ Binary layout of a message (up to 254 bytes long): ...@@ -52,9 +60,11 @@ Binary layout of a message (up to 254 bytes long):
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message body ... | Message body ...
+-+-+-+-+-+-+- ... +-+-+-+-+-+-+- ...
----
Binary layout of a larger message: Binary layout of a larger message:
----
0 1 2 3 0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
...@@ -66,15 +76,18 @@ Binary layout of a larger message: ...@@ -66,15 +76,18 @@ Binary layout of a larger message:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message body ... | Message body ...
+-+-+-+-+-+-+-+ ... +-+-+-+-+-+-+-+ ...
.fi ----
.SH "SEE ALSO" SEE ALSO
--------
linkzmq:zmq_udp[7]
linkzmq:zmq_pgm[7]
linkzmq:zmq_ipc[7]
linkzmq:zmq_inproc[7]
.BR zmq_udp (7)
.BR zmq_pgm (7)
.BR zmq_ipc (7)
.BR zmq_inproc (7)
.SH AUTHOR AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_term 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_term(3)
.SH NAME ===========
zmq_term \- terminates 0MQ context
.SH SYNOPSIS
.B int zmq_term (void *context); NAME
.SH DESCRIPTION ----
zmq_term - terminates 0MQ context
SYNOPSIS
--------
'int zmq_term (void *context);'
DESCRIPTION
-----------
Destroys 0MQ context. However, if there are still any sockets open within Destroys 0MQ context. However, if there are still any sockets open within
the context, the context, 'zmq_term' succeeds but shutdown of the context is delayed till
.IR zmq_term the last socket is closed.
succeeds but shutdown of the context is delayed till the last socket is closed.
.SH RETURN VALUE
Function returns zero is successful. Otherwise it returns -1 and RETURN VALUE
sets errno to one of the values below. ------------
.SH ERRORS Function returns zero is successful. Otherwise it returns -1 and sets errno to
one of the values below.
ERRORS
------
No errors are defined. No errors are defined.
.SH EXAMPLE
.nf
EXAMPLE
-------
----
int rc = zmq_term (context); int rc = zmq_term (context);
assert (rc == 0); assert (rc == 0);
.fi ----
.SH SEE ALSO
.BR zmq_init (3)
.BR zmq_close (3) SEE ALSO
.SH AUTHOR --------
linkzmq:zmq_init[3]
linkzmq:zmq_close[3]
AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_udp 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals" zmq_udp(7)
.SH NAME ==========
0MQ UDP Transport \- reliable multicast transport
.SH SYNOPSIS
NAME
----
zmq_udp - 0MQ reliable multicast transport using UDP
SYNOPSIS
--------
UDP transport is exactly the same as PGM transport except that PGM packets UDP transport is exactly the same as PGM transport except that PGM packets
are encapsulated in UDP packets. Rationale for this transport is that user-space are encapsulated in UDP packets. Rationale for this transport is that user-space
implementation of PGM requires right to create raw sockets (PGM is located implementation of PGM requires right to create raw sockets (PGM is located
...@@ -10,36 +16,41 @@ directly on top of IP layer in the networking stack), which is often not ...@@ -10,36 +16,41 @@ directly on top of IP layer in the networking stack), which is often not
available. UDP encapsulation solves this problem, however, it adds some overhead available. UDP encapsulation solves this problem, however, it adds some overhead
related to creating and transferring UDP packet headers. related to creating and transferring UDP packet headers.
.SH CONNECTION STRING
CONNECTION STRING
-----------------
Connection string for UDP transport is "udp://" followed by an IP address Connection string for UDP transport is "udp://" followed by an IP address
of the NIC to use, semicolon, IP address of the multicast group, colon and of the NIC to use, semicolon, IP address of the multicast group, colon and
port number. IP address of the NIC can be either its numeric representation port number. IP address of the NIC can be either its numeric representation
or the name of the NIC as reported by operating system. IP address of the or the name of the NIC as reported by operating system. IP address of the
multicast group should be specified in the numeric representation. For example: multicast group should be specified in the numeric representation. For example:
.nf ----
udp://eth0;224.0.0.1:5555 udp://eth0;224.0.0.1:5555
udp://lo;230.0.0.0:6666 udp://lo;230.0.0.0:6666
udp://192.168.0.111;224.0.0.1:5555 udp://192.168.0.111;224.0.0.1:5555
.fi ----
Note that NIC names are not standardised by POSIX. They tend to be rather NOTE: NIC names are not standardised by POSIX. They tend to be rather
arbitrary and platform dependent. Say, "eth0" on Linux would correspond to "en0" arbitrary and platform dependent. Say, "eth0" on Linux would correspond to "en0"
on OSX and "e1000g" on Solaris. On Windows platform, as there are no short NIC on OSX and "e1000g" on Solaris. On Windows platform, as there are no short NIC
names available, you have to use numeric IP addresses instead. names available, you have to use numeric IP addresses instead.
.SH WIRE FORMAT
WIRE FORMAT
-----------
Same as with PGM transport except for UDP packet headers. Same as with PGM transport except for UDP packet headers.
.SH "SEE ALSO"
.BR zmq_pgm (7) SEE ALSO
.BR zmq_tcp (7) --------
.BR zmq_ipc (7) linkzmq:zmq_pgm[7]
.BR zmq_inproc (7) linkzmq:zmq_tcp[7]
linkzmq:zmq_ipc[7]
linkzmq:zmq_inproc[7]
.SH AUTHOR AUTHOR
------
Martin Sustrik <sustrik at 250bpm dot com> Martin Sustrik <sustrik at 250bpm dot com>
dist_man_MANS = man1/zmq_forwarder.1 man1/zmq_streamer.1 man1/zmq_queue.1 \
man3/zmq_init.3 man3/zmq_term.3 \
man3/zmq_socket.3 man3/zmq_close.3 man3/zmq_setsockopt.3 man3/zmq_bind.3 \
man3/zmq_connect.3 man3/zmq_send.3 man3/zmq_flush.3 man3/zmq_recv.3 \
man3/zmq_poll.3 man3/zmq_msg_init.3 man3/zmq_msg_init_size.3 \
man3/zmq_msg_close.3 man3/zmq_msg_move.3 man3/zmq_msg_copy.3 \
man3/zmq_msg_data.3 man3/zmq_msg_size.3 man3/zmq_strerror.3 \
man7/zmq.7 man7/zmq_cpp.7 man7/zmq_python.7 \
man7/zmq_cl.7 man7/zmq_tcp.7 man7/zmq_udp.7 man7/zmq_pgm.7 \
man7/zmq_inproc.7 man7/zmq_ipc.7 man7/zmq_java.7
distclean-local:
-rm *.pdf
-rm man1/*.ps
-rm man3/*.ps
-rm man7/*.ps
dist-hook:
./convert2pdf.sh
$(mkdir_p) $(top_distdir)/doc
cp $(top_srcdir)/man/*.pdf $(top_distdir)/doc
#!/bin/sh
#
# Copyright (c) 2007-2010 iMatix Corporation
#
# This file is part of 0MQ.
#
# 0MQ is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# 0MQ is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Lesser GNU General Public License for more details.
#
# You should have received a copy of the Lesser GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
groff -man -Thtml man1/zmq_forwarder.1 > man1/zmq_forwarder.1.html
groff -man -Thtml man1/zmq_streamer.1 > man1/zmq_streamer.1.html
groff -man -Thtml man1/zmq_queue.1 > man1/zmq_queue.1.html
groff -man -Thtml man3/zmq_init.3 > man3/zmq_init.3.html
groff -man -Thtml man3/zmq_term.3 > man3/zmq_term.3.html
groff -man -Thtml man3/zmq_socket.3 > man3/zmq_socket.3.html
groff -man -Thtml man3/zmq_close.3 > man3/zmq_close.3.html
groff -man -Thtml man3/zmq_setsockopt.3 > man3/zmq_setsockopt.3.html
groff -man -Thtml man3/zmq_bind.3 > man3/zmq_bind.3.html
groff -man -Thtml man3/zmq_connect.3 > man3/zmq_connect.3.html
groff -man -Thtml man3/zmq_send.3 > man3/zmq_send.3.html
groff -man -Thtml man3/zmq_flush.3 > man3/zmq_flush.3.html
groff -man -Thtml man3/zmq_recv.3 > man3/zmq_recv.3.html
groff -man -Thtml man3/zmq_poll.3 > man3/zmq_poll.3.html
groff -man -Thtml man3/zmq_msg_init.3 > man3/zmq_msg_init.3.html
groff -man -Thtml man3/zmq_msg_init_size.3 > man3/zmq_msg_init_size.3.html
groff -man -Thtml man3/zmq_msg_init_data.3 > man3/zmq_msg_init_data.3.html
groff -man -Thtml man3/zmq_msg_close.3 > man3/zmq_msg_close.3.html
groff -man -Thtml man3/zmq_msg_move.3 > man3/zmq_msg_move.3.html
groff -man -Thtml man3/zmq_msg_copy.3 > man3/zmq_msg_copy.3.html
groff -man -Thtml man3/zmq_msg_data.3 > man3/zmq_msg_data.3.html
groff -man -Thtml man3/zmq_msg_size.3 > man3/zmq_msg_size.3.html
groff -man -Thtml man3/zmq_strerror.3 > man3/zmq_strerror.3.html
groff -man -Thtml man7/zmq.7 > man7/zmq.7.html
groff -man -Thtml man7/zmq_cpp.7 > man7/zmq_cpp.7.html
groff -man -Thtml man7/zmq_java.7 > man7/zmq_java.7.html
groff -man -Thtml man7/zmq_python.7 > man7/zmq_python.7.html
groff -man -Thtml man7/zmq_cl.7 > man7/zmq_cl.7.html
groff -man -Thtml man7/zmq_tcp.7 > man7/zmq_tcp.7.html
groff -man -Thtml man7/zmq_udp.7 > man7/zmq_udp.7.html
groff -man -Thtml man7/zmq_pgm.7 > man7/zmq_pgm.7.html
groff -man -Thtml man7/zmq_inproc.7 > man7/zmq_inproc.7.html
groff -man -Thtml man7/zmq_ipc.7 > man7/zmq_ipc.7.html
#!/bin/sh
#
# Copyright (c) 2007-2010 iMatix Corporation
#
# This file is part of 0MQ.
#
# 0MQ is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# 0MQ is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Lesser GNU General Public License for more details.
#
# You should have received a copy of the Lesser GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
groff -man -Tps man1/zmq_forwarder.1 > man1/zmq_forwarder.1.ps
ps2pdf man1/zmq_forwarder.1.ps zmq_forwarder.pdf
groff -man -Tps man1/zmq_streamer.1 > man1/zmq_streamer.1.ps
ps2pdf man1/zmq_streamer.1.ps zmq_streamer.pdf
groff -man -Tps man1/zmq_queue.1 > man1/zmq_queue.1.ps
ps2pdf man1/zmq_queue.1.ps zmq_queue.pdf
groff -man -Tps man3/zmq_init.3 > man3/zmq_init.3.ps
ps2pdf man3/zmq_init.3.ps zmq_init.pdf
groff -man -Tps man3/zmq_term.3 > man3/zmq_term.3.ps
ps2pdf man3/zmq_term.3.ps zmq_term.pdf
groff -man -Tps man3/zmq_socket.3 > man3/zmq_socket.3.ps
ps2pdf man3/zmq_socket.3.ps zmq_socket.pdf
groff -man -Tps man3/zmq_close.3 > man3/zmq_close.3.ps
ps2pdf man3/zmq_close.3.ps zmq_close.pdf
groff -man -Tps man3/zmq_setsockopt.3 > man3/zmq_setsockopt.3.ps
ps2pdf man3/zmq_setsockopt.3.ps zmq_setsockopt.pdf
groff -man -Tps man3/zmq_bind.3 > man3/zmq_bind.3.ps
ps2pdf man3/zmq_bind.3.ps zmq_bind.pdf
groff -man -Tps man3/zmq_connect.3 > man3/zmq_connect.3.ps
ps2pdf man3/zmq_connect.3.ps zmq_connect.pdf
groff -man -Tps man3/zmq_send.3 > man3/zmq_send.3.ps
ps2pdf man3/zmq_send.3.ps zmq_send.pdf
groff -man -Tps man3/zmq_flush.3 > man3/zmq_flush.3.ps
ps2pdf man3/zmq_flush.3.ps zmq_flush.pdf
groff -man -Tps man3/zmq_recv.3 > man3/zmq_recv.3.ps
ps2pdf man3/zmq_recv.3.ps zmq_recv.pdf
groff -man -Tps man3/zmq_poll.3 > man3/zmq_poll.3.ps
ps2pdf man3/zmq_poll.3.ps zmq_poll.pdf
groff -man -Tps man3/zmq_msg_init.3 > man3/zmq_msg_init.3.ps
ps2pdf man3/zmq_msg_init.3.ps zmq_msg_init.pdf
groff -man -Tps man3/zmq_msg_init_size.3 > man3/zmq_msg_init_size.3.ps
ps2pdf man3/zmq_msg_init_size.3.ps zmq_msg_init_size.pdf
groff -man -Tps man3/zmq_msg_init_data.3 > man3/zmq_msg_init_data.3.ps
ps2pdf man3/zmq_msg_init_data.3.ps zmq_msg_init_data.pdf
groff -man -Tps man3/zmq_msg_close.3 > man3/zmq_msg_close.3.ps
ps2pdf man3/zmq_msg_close.3.ps zmq_msg_close.pdf
groff -man -Tps man3/zmq_msg_move.3 > man3/zmq_msg_move.3.ps
ps2pdf man3/zmq_msg_move.3.ps zmq_msg_move.pdf
groff -man -Tps man3/zmq_msg_copy.3 > man3/zmq_msg_copy.3.ps
ps2pdf man3/zmq_msg_copy.3.ps zmq_msg_copy.pdf
groff -man -Tps man3/zmq_msg_data.3 > man3/zmq_msg_data.3.ps
ps2pdf man3/zmq_msg_data.3.ps zmq_msg_data.pdf
groff -man -Tps man3/zmq_msg_size.3 > man3/zmq_msg_size.3.ps
ps2pdf man3/zmq_msg_size.3.ps zmq_msg_size.pdf
groff -man -Tps man3/zmq_strerror.3 > man3/zmq_strerror.3.ps
ps2pdf man3/zmq_strerror.3.ps zmq_strerror.pdf
groff -man -Tps man7/zmq.7 > man7/zmq.7.ps
ps2pdf man7/zmq.7.ps zmq.pdf
groff -man -Tps man7/zmq_cpp.7 > man7/zmq_cpp.7.ps
ps2pdf man7/zmq_cpp.7.ps zmq_cpp.pdf
groff -man -Tps man7/zmq_java.7 > man7/zmq_java.7.ps
ps2pdf man7/zmq_java.7.ps zmq_java.pdf
groff -man -Tps man7/zmq_python.7 > man7/zmq_python.7.ps
ps2pdf man7/zmq_python.7.ps zmq_python.pdf
groff -man -Tps man7/zmq_cl.7 > man7/zmq_cl.7.ps
ps2pdf man7/zmq_cl.7.ps zmq_cl.pdf
groff -man -Tps man7/zmq_tcp.7 > man7/zmq_tcp.7.ps
ps2pdf man7/zmq_tcp.7.ps zmq_tcp.pdf
groff -man -Tps man7/zmq_udp.7 > man7/zmq_udp.7.ps
ps2pdf man7/zmq_udp.7.ps zmq_udp.pdf
groff -man -Tps man7/zmq_pgm.7 > man7/zmq_pgm.7.ps
ps2pdf man7/zmq_pgm.7.ps zmq_pgm.pdf
groff -man -Tps man7/zmq_inproc.7 > man7/zmq_inproc.7.ps
ps2pdf man7/zmq_inproc.7.ps zmq_inproc.pdf
groff -man -Tps man7/zmq_ipc.7 > man7/zmq_ipc.7.ps
ps2pdf man7/zmq_ipc.7.ps zmq_ipc.pdf
.TH zmq_forwarder 1 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
zmq_forwarder \- forwards the stream of PUB/SUB messages
.SH SYNOPSIS
.SH DESCRIPTION
.SH OPTIONS
.SH "SEE ALSO"
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_queue 1 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
zmq_queue \- forwards REQ/REP messages
.SH SYNOPSIS
.SH DESCRIPTION
.SH OPTIONS
.SH "SEE ALSO"
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_streamer 1 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
zmq_streamer \- forwards the stream of UPSTREAM/DOWNSTREAM messages
.SH SYNOPSIS
.SH DESCRIPTION
.SH OPTIONS
.SH "SEE ALSO"
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_close 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
zmq_close \- destroys 0MQ socket
.SH SYNOPSIS
.B int zmq_close (void *s);
.SH DESCRIPTION
Destroys 0MQ socket (one created using
.IR zmq_socket
function). All sockets have to be properly closed before the application
terminates, otherwise memory leaks will occur. Note that any outbound messages
that haven't been psuhed to the network yet and any inbound messages that
haven't been received by the application yet will be dropped on the socket
shutdown.
.SH RETURN VALUE
In case of success the function returns zero. Otherwise it returns -1 and
sets
.IR errno
to the appropriate value.
.SH ERRORS
No errors are defined.
.SH EXAMPLE
.nf
int rc = zmq_close (s);
assert (rc == 0);
.fi
.SH SEE ALSO
.BR zmq_socket (3)
.BR zmq_term (3)
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_init 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
zmq_init \- initialises 0MQ context
.SH SYNOPSIS
.B void *zmq_init (int app_threads, int io_threads, int flags);
.SH DESCRIPTION
Initialises 0MQ context.
.IR app_threads
specifies maximal number of application threads that can own open sockets
at the same time. At least one application thread should be defined.
.IR io_threads
specifies the size of thread pool to handle I/O operations. The value shouldn't
be negative. Zero can be used in case only in-process messaging is going to be
used, i.e. there will be no I/O traffic.
.IR flags
argument is a combination of the flags defined below:
.IP "\fBZMQ_POLL\fP"
flag specifying that the sockets within this context should be pollable (see
.IR zmq_poll
). Pollable sockets may add a little latency to the message transfer when
compared to non-pollable sockets.
.SH RETURN VALUE
Function returns context handle is successful. Otherwise it returns NULL and
sets errno to one of the values below.
.SH ERRORS
.IP "\fBEINVAL\fP"
there's less than one application thread allocated, or number of I/O threads
is negative.
.SH EXAMPLE
.nf
void *ctx = zmq_init (1, 1, ZMQ_POLL);
assert (ctx);
.fi
.SH SEE ALSO
.BR zmq_term (3)
.BR zmq_socket (3)
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_init_size 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
zmq_msg_init \- initialises 0MQ message of a specified size
.SH SYNOPSIS
.B int zmq_msg_init_size (zmq_msg_t *msg, size_t size);
.SH DESCRIPTION
Initialises 0MQ message
.IR size
bytes long. The implementation chooses whether it is more efficient to store
message content on the stack (small messages) or on the heap (large messages).
Therefore, never access message data directly via
.IR zmq_msg_t
members, rather use
.IR zmq_msg_data
and
.IR zmq_msg_size
functions to get message data and size. Note that the message data are not
nullified to avoid the associated performance impact. Thus you
should expect your message to contain bogus data after this call.
.SH RETURN VALUE
In case of success the function returns zero. Otherwise it returns -1 and
sets
.IR errno
to the appropriate value.
.SH ERRORS
.IP "\fBENOMEM\fP"
memory to hold the message cannot be allocated.
.SH EXAMPLE
.nf
zmq_msg_t msg;
rc = zmq_msg_init_size (&msg, 6);
assert (rc == 0);
memcpy (zmq_msg_data (&msg), "ABCDEF", 6);
rc = zmq_send (s, &msg, 0);
assert (rc == 0);
.fi
.SH SEE ALSO
.BR zmq_msg_close (3)
.BR zmq_msg_init (3)
.BR zmq_msg_init_data (3)
.BR zmq_msg_data (3)
.BR zmq_msg_size (3)
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_msg_move 3 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
zmq_msg_move \- moves content of a message to another message
.SH SYNOPSIS
.B int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src);
.SH DESCRIPTION
Move the content of the message from
.IR src
to
.IR dest .
The content isn't copied, just moved.
.IR src
becomes an empty message after the call. Original content of
.IR dest
message is deallocated.
.SH RETURN VALUE
In case of success the function returns zero. Otherwise it returns -1 and
sets
.IR errno
to the appropriate value.
.SH ERRORS
No errors are defined.
.SH EXAMPLE
.nf
zmq_msg_t dest;
rc = zmq_msg_init (&dest);
assert (rc == 0);
rc = zmq_msg_move (&dest, &src);
assert (rc == 0);
.fi
.SH SEE ALSO
.BR zmq_msg_copy (3)
.BR zmq_msg_init (3)
.BR zmq_msg_init_size (3)
.BR zmq_msg_init_data (3)
.BR zmq_msg_close (3)
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_cl 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
0MQ Common Lisp API \- interface between 0MQ and Common Lisp applications
.SH SYNOPSIS
This manual page explains how Common Lisp API maps to underlying C
API.
Common Lisp API repeats C API in general. All constants defined with C
API are available with Common Lisp API. C names are mapped to lisp
names by these rules: a) all names are `zmq' namespace; b) all names
are in lower case; c) underscores translate to dashes.
Example of mappings:
.IR zmq_msg_init_data
maps to
.IR zmq:msg-init-data
.IR ZMQ_PUB
maps to
.IR zmq:pub
To learn about individual functions and parameters check
appropriate C API manual pages.
For example, to understand
.IR zmq:setsockopt
function check
.BR zmq_setsockopt(3) .
.SH Data structures
Data structures are wrapped into CLOS classes with automatic memory
management. 0MQ describes two such structures:
.IR msg_t
and
.IR pollitem_t .
Message constructor supports keywords
.IR :size
and
.IR :data.
Keyword :size specifies the size of
message. Keyword :data specifies initial contents of message, and it
can be either string or 8-bit array. For example:
* (make-instance 'zmq:msg :data #(1 2 3))
creates a message with 3 bytes '1, 2, 3' in it.
.SH Accessing message data
There 3 functions to read message body in different forms:
msg-data-as-string, msg-data-as-array and msg-data-as-is, returning
data as string, as array and as raw foreign pointer to underlaying
buffer respectively. For example:
* (zmq:msg-data-as-array msg)
returns #(1 2 3) for message from previous example.
It is possible to access underlying foreign object via class slot
named `raw'.
* (slot-value obj 'zmq:raw)
or, if `obj' is of known type `msg':
* (zmq:msg-raw obj)
.SH Macros
There are several macroses to help with managing zeromq objects:
.SH with-context
Macro
.IR with-context
creates 0MQ context and requires 3 obligatory arguments: context name,
number of application threads and number of input/output
threads. Optional parameter `flags' can be also supplied, see
.BR zmq_init(3) .
Context is terminated implicitly at the end of macro block.
.SH with-socket
Macro
.IR with-socket
creates 0MQ socket within given context. Requires 3 arguments: socket
name, context name and socket type. See
.BR zmq_socket(3) .
Socket is closed implicitly at the end of macro block.
.SH with-polls
Macro
.IR with-polls
creates 0MQ polls, containing different sets of pollitems. For
example, to create two poll sets for network pipes:
* (zmq:with-polls ((poll1 . ((sock1 . zmq:pollin)
(sock2 . zmq:pollout)))
(poll2 . ((sock1 . zmq:pollout)
(sock2 . zmq:pollin))))
(process-sockets (zmq:poll poll-set1))
(process-sockets (zmq:poll poll-set2)))
Note,
.IR zmq:poll
returns list of revents for sockets from given poll set.
Polls are closed implicitly at the end of macro block.
.SH EXAMPLE
.nf
(zmq::with-context (ctx 1 1)
(zmq:with-socket (s ctx zmq:pub)
(zmq:connect s "tcp://192.168.0.115:5555")
(zmq:send s (make-instance 'zmq:msg :data "Hello, world!"))))
.SH "SEE ALSO"
.BR zmq(7)
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>,
Vitaly Mayatskikh <v dot mayatskih at gmail dot com>
.TH zmq_java 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
0MQ Java API \- interface between 0MQ and Java applications
.SH SYNOPSIS
.SH DESCRIPTION
.SH "SEE ALSO"
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
.TH zmq_python 7 "" "(c)2007-2010 iMatix Corporation" "0MQ User Manuals"
.SH NAME
0MQ Python API \- interface between 0MQ and Python applications
.SH SYNOPSIS
.SH DESCRIPTION
.SH "SEE ALSO"
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
...@@ -249,10 +249,10 @@ void zmq::fd_signaler_t::signal (int signal_) ...@@ -249,10 +249,10 @@ void zmq::fd_signaler_t::signal (int signal_)
uint64_t zmq::fd_signaler_t::poll () uint64_t zmq::fd_signaler_t::poll ()
{ {
// Set the reader to blocking mode. // Set the reader to blocking mode.
int flags = fcntl (fd, F_GETFL, 0); int flags = fcntl (r, F_GETFL, 0);
if (flags == -1) if (flags == -1)
flags = 0; flags = 0;
int rc = fcntl (fd, F_SETFL, flags & ~O_NONBLOCK); int rc = fcntl (r, F_SETFL, flags & ~O_NONBLOCK);
errno_assert (rc != -1); errno_assert (rc != -1);
// Poll for events. // Poll for events.
......
...@@ -268,7 +268,11 @@ zmq::fd_t zmq::tcp_connecter_t::connect () ...@@ -268,7 +268,11 @@ zmq::fd_t zmq::tcp_connecter_t::connect ()
// Following code should handle both Berkeley-derived socket // Following code should handle both Berkeley-derived socket
// implementations and Solaris. // implementations and Solaris.
int err = 0; int err = 0;
socklen_t len = sizeof err; #if defined ZMQ_HAVE_HPUX
int len = sizeof (err);
#else
socklen_t len = sizeof (err);
#endif
int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len); int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
if (rc == -1) if (rc == -1)
err = errno; err = errno;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment