Commit d71b6291 authored by Christian Fibich's avatar Christian Fibich
Browse files

Update README.md

parent e16e50f0
...@@ -62,17 +62,16 @@ of the following parts in this order: ...@@ -62,17 +62,16 @@ of the following parts in this order:
2. A message providing further details on the completion status in 2. A message providing further details on the completion status in
a *non-terminated* string a *non-terminated* string
[NOTE] NOTE:
============
*non-terminated* means that the trailing `\0` byte is not transmitted *non-terminated* means that the trailing `\0` byte is not transmitted
via ZeroMQ. via ZeroMQ.
You may use the functions in `common/zmq_strings.c` to send/receive You may use the functions in `common/zmq_strings.c` to send/receive
conventional C strings via ZeroMQ conventional C strings via ZeroMQ
============
[TIP] TIP:
============
Multi-part messages can be *sent* by supplying the `ZMQ_SNDMORE` to Multi-part messages can be *sent* by supplying the `ZMQ_SNDMORE` to
the [`zmq_send(3)`](http://api.zeromq.org/4-0:zmq-send) and [`zmq_msg_send(3)`](http://api.zeromq.org/4-0:zmq-msg-send) functions in all but the last the [`zmq_send(3)`](http://api.zeromq.org/4-0:zmq-send) and [`zmq_msg_send(3)`](http://api.zeromq.org/4-0:zmq-msg-send) functions in all but the last
message parts. message parts.
...@@ -83,17 +82,16 @@ message, use ...@@ -83,17 +82,16 @@ message, use
* [`zmq_msg_more(3)`](http://api.zeromq.org/4-0:zmq-msg-more) on the message object if using link:http://api.zeromq.org/4-0:zmq-msg-recv[`zmq_msg_recv(3)`] or * [`zmq_msg_more(3)`](http://api.zeromq.org/4-0:zmq-msg-more) on the message object if using link:http://api.zeromq.org/4-0:zmq-msg-recv[`zmq_msg_recv(3)`] or
* or [`zmq_getsockopt(3)`](http://api.zeromq.org/4-0:zmq-getsockopt) on the socket with the `ZMQ_RCVMORE` option name if using [`zmq_recv(3)`](http://api.zeromq.org/4-0:zmq-recv). * or [`zmq_getsockopt(3)`](http://api.zeromq.org/4-0:zmq-getsockopt) on the socket with the `ZMQ_RCVMORE` option name if using [`zmq_recv(3)`](http://api.zeromq.org/4-0:zmq-recv).
============
[NOTE]
============ NOTE:
You can read/write to a ZeroMQ socket directly from a buffer (e.g., an array) via You can read/write to a ZeroMQ socket directly from a buffer (e.g., an array) via
[`zmq_recv(3)`](http://api.zeromq.org/4-0:zmq-recv)/[`zmq_send(3)`](http://api.zeromq.org/4-0:zmq-send) or via ZeroMQ message objects using [`zmq_msg_recv(3)`](http://api.zeromq.org/4-0:zmq-msg-recv)/[`zmq_msg_send(3)`](http://api.zeromq.org/4-0:zmq-msg-send) [`zmq_recv(3)`](http://api.zeromq.org/4-0:zmq-recv)/[`zmq_send(3)`](http://api.zeromq.org/4-0:zmq-send) or via ZeroMQ message objects using [`zmq_msg_recv(3)`](http://api.zeromq.org/4-0:zmq-msg-recv)/[`zmq_msg_send(3)`](http://api.zeromq.org/4-0:zmq-msg-send)
ZeroMQ messages provide an advantage for the receiver side: ZeroMQ allocates ZeroMQ messages provide an advantage for the receiver side: ZeroMQ allocates
as much memory as is needed to store the message dynamically. as much memory as is needed to store the message dynamically.
A ZeroMQ message is just a variable of type `zmq_msg_t`. When messages are A ZeroMQ message is just a variable of type `zmq_msg_t`. When messages are
no longer needed, they have to be freed using [`zmq_msg_close(3)`](http://api.zeromq.org/4-0:zmq-msg-close). no longer needed, they have to be freed using [`zmq_msg_close(3)`](http://api.zeromq.org/4-0:zmq-msg-close).
============
The _Poster_ client shall provide the following command-line interface: The _Poster_ client shall provide the following command-line interface:
...@@ -109,20 +107,18 @@ server. ...@@ -109,20 +107,18 @@ server.
It may subscribe to one or more channels, which shall be passed as It may subscribe to one or more channels, which shall be passed as
command-line arguments. command-line arguments.
[TIP] TIP:
============
Subscribing to a particular prefix is done by calling [`zmq_setsockopt(3)`](http://api.zeromq.org/4-0:zmq-setsockopt) Subscribing to a particular prefix is done by calling [`zmq_setsockopt(3)`](http://api.zeromq.org/4-0:zmq-setsockopt)
on the socket with `ZMQ_SUBSCRIBE` as _option name_ and the prefix data on the socket with `ZMQ_SUBSCRIBE` as _option name_ and the prefix data
(in this case, the channel name) as _option value_. (in this case, the channel name) as _option value_.
============
[NOTE] NOTE]:
============
To prevent that a subscriber subscribed to channel _cat_ also To prevent that a subscriber subscribed to channel _cat_ also
receives messages from channel _catastrophes_ (due to the common prefix _cat_), receives messages from channel _catastrophes_ (due to the common prefix _cat_),
append the separator character `SEP` from `common/messages.h` to the channel append the separator character `SEP` from `common/messages.h` to the channel
name before calling `zmq_setsockopt(...,ZMQ_SUBSCRIBE,...)`. name before calling `zmq_setsockopt(...,ZMQ_SUBSCRIBE,...)`.
============
Once connected and subscribed, the _Printer_ client may start to receive Once connected and subscribed, the _Printer_ client may start to receive
messages from the server. messages from the server.
......
Supports Markdown
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